MCPcopy Create free account
hub / github.com/SeaOfNodes/Simple / was_nl

Method was_nl

chapter18/src/main/java/com/seaofnodes/simple/SB.java:49–58  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

47 public SB nl( ) { return p(System.lineSeparator()); }
48 // Last printed a nl
49 public boolean was_nl() {
50 int len = _sb.length();
51 String nl = System.lineSeparator();
52 int nlen = nl.length();
53 if( len < nlen ) return false;
54 for( int i=0; i<nlen; i++ )
55 if( _sb.charAt(len-nlen+i)!=nl.charAt(i) )
56 return false;
57 return true;
58 }
59
60 // Delete last char. Useful when doing string-joins and JSON printing and an
61 // extra separater char needs to be removed:

Callers

nothing calls this directly

Calls 1

lengthMethod · 0.45

Tested by

no test coverage detected