Hi,
I'm currently writing a basic program (only been using Java for 3 weeks), and am trying to locate the "index position" of the first number in a string.
For example String = "slow by 10.40s" or "fast by 1m2.2s" and want to use a method that returns me the index position of the very first integer i encounter in the string (or even better the whole number - tried using ParseDouble but obviously get a number exception).
I've attempted to write my own "method" to loop through numbers 1-9 and return the lowest index position, but realised that if it didn't find a number( ie 3 in the above examples) the lowest index position was -1.......
I guess i could examine each character in the string individually to determine if it is an integer or not, but can't believe that the "firstInt" code isn't already in a class??
Apologies if the terminology is wrong in this post, i'm still learning about classes and methods and constructors etc......
if anyone can help point me in the right direction it would be most appreciated.
Jake