MCPcopy Create free account
hub / github.com/comaps/comaps / CountNormLowerSymbols

Function CountNormLowerSymbols

libs/base/lower_case.cpp:795–819  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

793}
794
795size_t CountNormLowerSymbols(UniString const & s, UniString const & lowStr)
796{
797 size_t const size = s.size();
798 size_t const lowSize = lowStr.size();
799 size_t lowIdx = 0, sIdx = 0;
800
801 while (lowIdx < lowSize)
802 {
803 if (sIdx == size)
804 return 0; // low_s has more length than s
805
806 UniString strCharNorm;
807 strCharNorm.push_back(s[sIdx++]);
808 MakeLowerCaseInplace(strCharNorm);
809 NormalizeInplace(strCharNorm);
810
811 for (size_t i = 0; i < strCharNorm.size(); ++i)
812 if (lowIdx >= lowSize)
813 return sIdx;
814 else if (lowStr[lowIdx++] != strCharNorm[i])
815 return 0;
816 }
817
818 return sIdx;
819}
820
821} // namespace strings

Callers 2

UNIT_TESTFunction · 0.85

Calls 4

NormalizeInplaceFunction · 0.85
MakeLowerCaseInplaceFunction · 0.70
sizeMethod · 0.45
push_backMethod · 0.45

Tested by 1

UNIT_TESTFunction · 0.68