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

Method was_nl

chapter20/src/main/java/com/seaofnodes/simple/SB.java:65–74  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

63 public SB nl( ) { return p(System.lineSeparator()); }
64 // Last printed a nl
65 public boolean was_nl() {
66 int len = _sb.length();
67 String nl = System.lineSeparator();
68 int nlen = nl.length();
69 if( len < nlen ) return false;
70 for( int i=0; i<nlen; i++ )
71 if( _sb.charAt(len-nlen+i)!=nl.charAt(i) )
72 return false;
73 return true;
74 }
75
76 // Delete last char. Useful when doing string-joins and JSON printing and an
77 // extra separater char needs to be removed:

Callers

nothing calls this directly

Calls 1

lengthMethod · 0.45

Tested by

no test coverage detected