MCPcopy Create free account
hub / github.com/appdevforall/CodeOnTheGo / titlecase

Method titlecase

subprojects/llama.cpp/common/jinja/string.cpp:146–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144 });
145}
146string string::titlecase() {
147 return apply_transform(*this, [](const std::string & s) {
148 std::string res = s;
149 bool capitalize_next = true;
150 for (char &c : res) {
151 if (isspace(static_cast<unsigned char>(c))) {
152 capitalize_next = true;
153 } else if (capitalize_next) {
154 c = ::toupper(static_cast<unsigned char>(c));
155 capitalize_next = false;
156 } else {
157 c = ::tolower(static_cast<unsigned char>(c));
158 }
159 }
160 return res;
161 });
162}
163string string::strip(bool left, bool right, std::optional<const std::string_view> chars) {
164 static auto strip_part = [](const std::string & s, bool left, bool right, std::optional<const std::string_view> chars) -> std::string {
165 size_t start = 0;

Callers 9

generateSourcesMethod · 0.80
value.cppFile · 0.80
LocaleValueClass · 0.80
bindDefaultMessageMethod · 0.80
buildSystemMessageMethod · 0.80
capitalizeStringFunction · 0.80
capitalizedFunction · 0.80
buildSystemMessageMethod · 0.80

Calls 1

apply_transformFunction · 0.85

Tested by

no test coverage detected