Returns the given string with all occurrences of the given character removed from its left side. @param s the string to trim @param c the character to remove @return the trimmed string
(String s, char c)
| 2599 | * @return the trimmed string |
| 2600 | */ |
| 2601 | public static String trimLeft(String s, char c) { |
| 2602 | int len = s.length(); |
| 2603 | int start; |
| 2604 | for (start = 0; start < len && s.charAt(start) == c; start++); |
| 2605 | return start == 0 ? s : s.substring(start); |
| 2606 | } |
| 2607 | |
| 2608 | /** |
| 2609 | * Trims duplicate consecutive occurrences of the given character within the |