MCPcopy Index your code
hub / github.com/antlr/codebuff / trimOneTrailingNewline

Method trimOneTrailingNewline

output/java8/1.4.19/Misc.java:85–89  ·  view source on GitHub ↗

Strip a single newline character from the end of s.

(String s)

Source from the content-addressed store, hash-verified

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}

Callers 2

defineTemplateMethod · 0.95
defineRegionMethod · 0.95

Calls 1

lengthMethod · 0.45

Tested by

no test coverage detected