java - How to split a string or get the right text from string -
this question has answer here:
- java: simplest way last word in string 5 answers
i need split string. right now, string contains this:
"rm 8 text"
now want text printed in string builder using append, how rid of rm 8 in start of string?
right have done way, there has easier way.
string[] lines = fromserver.split("\\s+"); string line2 = lines[2]; logbuilder.append(line2);
assuming standard format
string lastword = fromserver.substring(fromserver.lastindexof(" ")+1);
Comments
Post a Comment