MCPcopy Create free account
hub / github.com/davisking/dlib / count_newlines

Function count_newlines

tools/htmlify/to_xml.cpp:190–205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

188// ----------------------------------------------------------------------------------------
189
190unsigned long count_newlines (
191 const string& str
192)
193/*!
194 ensures
195 - returns the number of '\n' characters inside str
196!*/
197{
198 unsigned long count = 0;
199 for (unsigned long i = 0; i < str.size(); ++i)
200 {
201 if (str[i] == '\n')
202 ++count;
203 }
204 return count;
205}
206
207// ----------------------------------------------------------------------------------------
208

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected