A
Andreas Leitgeb
I'd need to trim only *trailing* whitespace off a String (or StringBuilder)
while preserving leading white space. Furthermore (unlike trim()), I'd only
strip exact \u0020 chars, no other control chars.
I could code a while-loop to search for last non-\u0020 char position and then
extract the approriate substring (or delete() the spaces), but if there is a
more elegant solution that I've missed in the javadocs, then I'd be glad about
a hint.
PS: no need to code out any solutions involving explicit loops.
PPS: target is Java SE 7
while preserving leading white space. Furthermore (unlike trim()), I'd only
strip exact \u0020 chars, no other control chars.
I could code a while-loop to search for last non-\u0020 char position and then
extract the approriate substring (or delete() the spaces), but if there is a
more elegant solution that I've missed in the javadocs, then I'd be glad about
a hint.
PS: no need to code out any solutions involving explicit loops.
PPS: target is Java SE 7