List of utility methods to do String Trim Right
String | rightTrim(String value) right Trim if (value == null) { return ""; int length = value.length(); for (int i = length - 1; i >= 0; i--) { if (value.charAt(i) != 0x20) { break; length--; return value.substring(0, length); |
String[] | rightTrim(String[] values) right Trim isNull(values); StringBuffer b = null; for (int j = 0; j < values.length; j++) { b = new StringBuffer(values[j]); for (int k = b.length() - 1; k >= 0; k--) { if (b.charAt(k) == ' ') { b.deleteCharAt(k); } else if (b.charAt(k) != ' ') { ... |
StringBuilder | rightTrim(StringBuilder pStringBuilder) Similar to the Perl chomp command. int endPos = pStringBuilder.length() - 1; while (endPos != -1 && Character.isWhitespace(pStringBuilder.charAt(endPos))) { pStringBuilder.deleteCharAt(endPos); return pStringBuilder; |
String | rightTrimNewLineChars(String input) Removes the occurrences of the passed char in the end of the string. int len = input.length(); int st = 0; int off = 0; char c; while ((st < len) && ((c = input.charAt(off + len - 1)) == '\r' || c == '\n')) { len--; return input.substring(0, len); ... |
int | rightTrimSize(String s) Returns the size of substring that does not contain any trailing spaces int i = s.length(); while (i > 0) { i--; if (s.charAt(i) != ' ') { return i + 1; return 0; ... |
String | rightTrimSlashes(String s) Returns the specified string with all trailing slashes removed. while (s.endsWith("/")) { s = s.substring(0, s.length() - 1); return s; |
String | rightTrimString(String originalString) Returns a new string with all space characters removed from the right int len = originalString.length(); while ((len > 0) && (originalString.charAt(len - 1) <= ' ')) { len--; return originalString.substring(0, len); |
String | rtrim(final String input) rtrim if (input == null) return null; if (input.isEmpty()) return input; int i = input.length() - 1; while (i >= 0 && input.charAt(i) == ' ') --i; return input.substring(0, i + 1); ... |
String | rtrim(final String str) rtrim int i, j; for (i = str.length() - 1; i >= 0; i--) { char ch = str.charAt(i); if (ch != ' ') { break; char[] res = new char[i + 1]; ... |
String | rtrim(final String str, final char filler) PErforms right trim if (str == null) return null; for (int i = str.length() - 1; i >= 0; --i) { if (str.charAt(i) != filler) return str.substring(0, i + 1); return ""; |