I searched the searches and tried to figure out what the lastIndexOf behavior is, but cannot find the answer to it ...
I have a potentially large string that I need to look for, and I'm 99% sure that the tag, ex: </data> , will be at the end of it. I am trying to clear this and add additional data to the line, and then close it again after.
I am currently using indexOf, but performance is my top priority, so I was thinking about using lastIndexOf ...
Can any Java expert confirm if lastIndexOf will search on the back of the string?
Example:
xml = xml.substring(0, xml.lastIndexOf("</data>")); xml+"<mystuff>hello world</mysruff>"; xml+"</data>";
source share