@Test public void leftTrimTest() { assertNull(leftTrim(null)); assertEquals(leftTrim(""), ""); assertEquals(leftTrim(" \t "), ""); assertEquals(leftTrim(" 123"), "123"); assertEquals(leftTrim("\t123"), "123"); assertEquals(leftTrim("\n123"), "123"); assertEquals(leftTrim("123"), "123"); assertEquals(leftTrim(" \n 123"), "123"); assertEquals(leftTrim("123 "), "123 "); assertEquals(leftTrim(" 3 123 "), "3 123 "); }
public static String leftTrim(String s) { if (s == null) { return null; } if (s.length() == 0) { return EMPTY_STRING; } int j = 0; for (int i = 0; i < s.length(); i++) { if (Character.isWhitespace(s.charAt(i))) { j++; } else { break; } } return s.substring(j); }
Strings { public static String leftTrim(String s) { if (s == null) { return null; } if (s.length() == 0) { return EMPTY_STRING; } int j = 0; for (int i = 0; i < s.length(); i++) { if (Character.isWhitespace(s.charAt(i))) { j++; } else { break; } } return s.substring(j); } }
Strings { public static String leftTrim(String s) { if (s == null) { return null; } if (s.length() == 0) { return EMPTY_STRING; } int j = 0; for (int i = 0; i < s.length(); i++) { if (Character.isWhitespace(s.charAt(i))) { j++; } else { break; } } return s.substring(j); } private  Strings(); }
Strings { public static String leftTrim(String s) { if (s == null) { return null; } if (s.length() == 0) { return EMPTY_STRING; } int j = 0; for (int i = 0; i < s.length(); i++) { if (Character.isWhitespace(s.charAt(i))) { j++; } else { break; } } return s.substring(j); } private  Strings(); static boolean isNullOrEmpty(String str); static boolean hasText(String s); static boolean allHasText(String... strings); static boolean allNullOrEmpty(String... strings); static String leftTrim(String s); static String rightTrim(String str); static boolean containsNone(String str, String invalidCharsStr); static boolean containsOnly(String str, String allowedChars); static String repeat(char c, int count); static String repeat(String str, int count); static String reverse(String str); static String insertFromLeft(String str, int interval, String stringToInsert); static String insertFromRight(String str, int interval, String stringToInsert); static String rightPad(String str, int size); static String rightPad(String str, int size, char padChar); static String rightPad(String str, int size, String padStr); static String leftPad(String str, int size); static String leftPad(String str, int size, char padChar); static String subStringUntilFirst(String str, String s); static String subStringUntilLast(String str, String s); static String subStringAfterFirst(String str, String s); static String subStringAfterLast(String str, String s); static String leftPad(String str, int size, String padStr); static String whiteSpacesToSingleSpace(String str); static String eliminateWhiteSpaces(String str); static String[] separateGrams(String word, int gramSize); }
Strings { public static String leftTrim(String s) { if (s == null) { return null; } if (s.length() == 0) { return EMPTY_STRING; } int j = 0; for (int i = 0; i < s.length(); i++) { if (Character.isWhitespace(s.charAt(i))) { j++; } else { break; } } return s.substring(j); } private  Strings(); static boolean isNullOrEmpty(String str); static boolean hasText(String s); static boolean allHasText(String... strings); static boolean allNullOrEmpty(String... strings); static String leftTrim(String s); static String rightTrim(String str); static boolean containsNone(String str, String invalidCharsStr); static boolean containsOnly(String str, String allowedChars); static String repeat(char c, int count); static String repeat(String str, int count); static String reverse(String str); static String insertFromLeft(String str, int interval, String stringToInsert); static String insertFromRight(String str, int interval, String stringToInsert); static String rightPad(String str, int size); static String rightPad(String str, int size, char padChar); static String rightPad(String str, int size, String padStr); static String leftPad(String str, int size); static String leftPad(String str, int size, char padChar); static String subStringUntilFirst(String str, String s); static String subStringUntilLast(String str, String s); static String subStringAfterFirst(String str, String s); static String subStringAfterLast(String str, String s); static String leftPad(String str, int size, String padStr); static String whiteSpacesToSingleSpace(String str); static String eliminateWhiteSpaces(String str); static String[] separateGrams(String word, int gramSize); static final String EMPTY_STRING; static final String[] EMPTY_STRING_ARRAY; }