This week's book giveaway is in the NodeJS forum.
We're giving away four copies of Serverless Applications with Node.js and have Slobodan Stojanovic & Aleksandar Simovic on-line!
See this thread for details.
Win a copy of Serverless Applications with Node.js this week in the NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Ron McLeod
  • Tim Moores
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Vijitha Kumara

part of an if Statement being ignored  RSS feed

 
Ranch Hand
Posts: 147
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been looking at this issue for some time and can not see what is wrong with it, not the sort of question that you can easily google the problem being that the method removes the 3 character words as required but  does not remove the word series, i have tried put space either side and both side which has no effect it still gets through and i can not see why here is the  code


the string i send to the method being Book 13 in the Chief Inspector Wexford series
and the result = new string =  Book 13 Chief Inspector Wexford series

much as i expected apart from the word series remaining
 
author & internet detective
Posts: 39208
726
Eclipse IDE Java VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Peter,
In Java, == and != are for comparing object references or primitives.

To compare actual String values, you need
 
peter m hayward
Ranch Hand
Posts: 147
2
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you so much for the pointer, this is something i was aware of but forgot, I do not do programming as a job i am a secondhand book seller having spent 30 years or more in electronics and computing and finished a degree in programming and mathematics in 2007 at the age of 51, the help i have received on this site has been amazing
 
Marshal
Posts: 63822
209
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See our FAQ. Maybe if we called == the “same object” operator, you would remember it better
 
Attractive, successful people love this tiny ad:
global solutions you can do at home or in your backyard
https://www.kickstarter.com/projects/paulwheaton/better-world-boo
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!