The input is XYZ
The String array contains three string
i.e.
- test.alpha.beta.XYZWorld
- test.gamaa.mu.XYZ
- test.nu.tera.XYZ
I need the last two result if i provide the input “XYZ”. Not the test.alpha.beta.XYZWorld.
if i use lastIndexOf method defined in java.lang.String, obviously it returns 1,2 and 3 result.
Please help.
There is an
endsWith()method inString.