Returns the given string with all occurrences of the given character removed from its right side. @param s the string to trim @param c the character to remove @return the trimmed string
(String s, char c)
| 2584 | * @return the trimmed string |
| 2585 | */ |
| 2586 | public static String trimRight(String s, char c) { |
| 2587 | int len = s.length() - 1; |
| 2588 | int end; |
| 2589 | for (end = len; end >= 0 && s.charAt(end) == c; end--); |
| 2590 | return end == len ? s : s.substring(0, end + 1); |
| 2591 | } |
| 2592 | |
| 2593 | /** |
| 2594 | * Returns the given string with all occurrences of the given character |
no outgoing calls
no test coverage detected