MCPcopy Create free account
hub / github.com/apache/fory / needs_snake_separator

Function needs_snake_separator

cpp/fory/util/string_util.h:208–225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

206}
207
208constexpr bool needs_snake_separator(std::string_view name, size_t index) {
209 if (index == 0)
210 return false;
211 char curr = name[index];
212 if (!is_upper_ascii(curr))
213 return false;
214
215 char prev = name[index - 1];
216 if (is_lower_ascii(prev) || is_digit_ascii(prev))
217 return true;
218
219 if (is_upper_ascii(prev) && index + 1 < name.size()) {
220 char next = name[index + 1];
221 if (is_lower_ascii(next))
222 return true;
223 }
224 return false;
225}
226
227constexpr size_t snake_case_length(std::string_view name) {
228 size_t length = 0;

Callers 2

snake_case_lengthFunction · 0.85
to_snake_caseFunction · 0.85

Calls 4

is_upper_asciiFunction · 0.85
is_lower_asciiFunction · 0.85
is_digit_asciiFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected