This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of React Cookbook: Recipes for Mastering the React Framework and have David Griffiths & Dawn Griffiths on-line!
See this thread for details.
Win a copy of React Cookbook: Recipes for Mastering the React Framework this week in the HTML Pages with CSS and JavaScript 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Himai Minh

Need Help to Understand indexOf Return Value

 
Ranch Hand
Posts: 2119
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My code:



Return:

AbstractDisposition: newDispositionRecord: Running Message Function: 3
AbstractDisposition: newDispositionRecord: Running Message Function: 1,2,3,4,5
AbstractDisposition: newDispositionRecord: Running Message Function: -1
 
Ranch Hand
Posts: 2410
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
indexOf tells you where the target is found in the String. If it returns -1, it means it wasn't found.
 
Steve Dyke
Ranch Hand
Posts: 2119
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Keith Lynn wrote:indexOf tells you where the target is found in the String. If it returns -1, it means it wasn't found.



I understand that but my string is 1,2,3,4,5

And the value I am looking for is 3
 
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could QMSConfiguration be producing different results on the two constructor calls?

What classes are you dealing with here?

Does disp.getDispType return a String?
Does getValue() return a String?
 
Steve Dyke
Ranch Hand
Posts: 2119
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Dave Tolls wrote:Could QMSConfiguration be producing different results on the two constructor calls?

What classes are you dealing with here?

Does disp.getDispType return a String?
Does getValue() return a String?



Thanks for the tip. I was looking for an int in the string.
 
Dave Tolls
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, but is the result of the two calls to that constructor the same?

If it were me I would have used a variable for QMSConfiguration and used the same object.
 
Dinner will be steamed monkey heads with a side of tiny ads.
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic