public static String trimRight(String s)Note: This is declared
staticbecause it is doesn't depend on any instance variables from the class it would be defined in, only on its parameters. It's declared
publiconly because it might be generally useful.
|Not trimmed on left.|
|No trimming of the empty string.|
|All whitespace trimmed to nothing|
Character.isWhitespace()to test each character. When you find find something that isn't whitespace, return everything up to and including that character.