Is it possible to use a java contains with lastIndexOf?
I am grabbing some information out of a file, and need to grab the last occurrence of it.
the file looks like this
17,560.0
17,583.0
17,606.0
And I am using something like this.
System.out.println(lines.indexOf("17"));
However it wont work because it looks for exactly the 17, and wont take any more.
Any way around this?
No. You will need to loop through the collection to get that kind of
lastIndexOf.Something like:
Then you will get in
livalue of last index with a line starting with17. Ifliis-1, then a value starting with17was not found.