MCPcopy Create free account
hub / github.com/GothenburgBitFactory/taskwarrior / commonLength

Method commonLength

src/Lexer.cpp:267–273  ·  view source on GitHub ↗

/////////////////////////////////////////////////////////////////////////// Compares two strings, and returns the number bytes in common. left: wonderful right: wonderbread returns: ^ 6

Source from the content-addressed store, hash-verified

265// right: wonderbread
266// returns: ^ 6
267std::string::size_type Lexer::commonLength(const std::string& left, const std::string& right) {
268 std::string::size_type l = 0;
269 std::string::size_type r = 0;
270 while (left[l] == right[r] && utf8_next_char(left, l) && utf8_next_char(right, r));
271
272 return l;
273}
274
275////////////////////////////////////////////////////////////////////////////////
276// Compares two strings with offsets, and returns the number bytes in common.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected