• Post Reply Bookmark Topic Watch Topic
  • New Topic

Using indexOf to Check for String in a String  RSS feed

 
Steve Dyke
Ranch Hand
Posts: 1783
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having difficulty getting indexOf to work for me. The output below shows the two strings are exactly the same yet I get  a -1 value.

snippet


My console output:

PONumberCompiler: 6290R0000055, -  6290R0000055, - -1
 
Ryan McGuire
Ranch Hand
Posts: 1143
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like eeiftx has a leading space.  Print out the length of each string.  Are the lengths what you expect?

Edit:
Try

...or do the trim() in the getEeiftx() function.
 
Steve Dyke
Ranch Hand
Posts: 1783
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ryan McGuire wrote:It looks like eeiftx has a leading space.  Print out the length of each string.  Are the lengths what you expect?

Edit:
Try

...or do the trim() in the getEeiftx() function.


Thanks, that did the trick.
In the class where the ponumberV7 eeiftx value gets assigned(remote data call) I am doing a trim. I cannot figure out how it gets a trailing space. But anyway..
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!