Strip a single newline character from the end of s.
(String s)
| 83 | /** Strip a single newline character from the end of {@code s}. */ |
| 84 | |
| 85 | public static String trimOneTrailingNewline(String s) { |
| 86 | if ( s.endsWith("\r\n") ) s = s.substring(0, s.length()-2); |
| 87 | else if ( s.endsWith("\n") ) s = s.substring(0, s.length()-1); |
| 88 | return s; |
| 89 | } |
| 90 | |
| 91 | /** Given, say, {@code file:/tmp/test.jar!/org/foo/templates/main.stg} |
| 92 | * convert to {@code file:/tmp/test.jar!/org/foo/templates} |
no test coverage detected