Can you please tell me how to search in reveres order (backward search) in Java?
I need to do same for searching in HTML file as text.
[...] how to search in reveres order (backward search) in java?
I assume you mean search for a string starting from the end.
For this task you can use String.lastIndexOf(str)
. This will locate the last index of the substring str
. If you want to keep searching from that point, you can add a second fromIndex
argument.
The exact same methods exist for StringBuilder
as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With