MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / count

Function count

extlibs/vili/src/utils.cpp:12–22  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10{
11 constexpr auto is_digit = static_cast<int (*)(int)>(std::isdigit);
12 size_t count(const std::string& str, const std::string& occur)
13 {
14 int occurrences = 0;
15 std::string::size_type start = 0;
16 while ((start = str.find(occur, start)) != std::string::npos)
17 {
18 ++occurrences;
19 start += occur.length();
20 }
21 return occurrences;
22 }
23
24 bool is_int(const std::string& str)
25 {

Callers 1

is_floatFunction · 0.85

Calls 2

findMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected