MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / endsWith

Function endsWith

lib/core/utils.cc:67–83  ·  view source on GitHub ↗

Case-insensitive for endings within ASCII.

Source from the content-addressed store, hash-verified

65
66// Case-insensitive for endings within ASCII.
67bool endsWith(const std::string& value, const std::string& ending)
68{
69 if (ending.size() > value.size())
70 return false;
71
72 std::string lowercase(ending.size(), 0);
73 std::transform(value.rbegin(),
74 value.rbegin() + ending.size(),
75 lowercase.begin(),
76 [](unsigned char c)
77 {
78 return std::tolower(c);
79 });
80
81 return std::equal(ending.rbegin(), ending.rend(), value.rbegin()) ||
82 std::equal(ending.rbegin(), ending.rend(), lowercase.begin());
83}
84
85std::string toUpper(const std::string& value)
86{

Callers 3

saveMethod · 0.85
setImageReaderMethod · 0.85
setImageWriterMethod · 0.85

Calls 2

sizeMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected