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