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

Method trimOneTrailingNewline

output/java8/1.4.13/Misc.java:87–91  ·  view source on GitHub ↗

Strip a single newline character from the end of s.

(String s)

Source from the content-addressed store, hash-verified

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