src/org/kocakosm/pitaya/util/Strings.java
public static String trimRight(String str)
	{
		int end = str.length();
		for (int i = str.length() - 1; i >= 0; i--) {
			if (str.charAt(i) != ' ') {
				break;
			}
			end--;
		}
		return str.substring(0, end);
	}
public static String trimRight(String str)
	{
		int end = str.length();
		for (int i = str.length() - 1; i >= 0; i--) {
			if (str.charAt(i) != ' ') {
				break;
			}
			end--;
		}
		return str.substring(0, end);
	}
Returns a copy of the given {@code String} with trailing whitespaces
omitted.

@param str the {@code String} to trim.

@return the trimmed {@code String}.

@throws NullPointerException if {@code str} is {@code null}.