MCPcopy Create free account
hub / github.com/DFHack/dfhack / to_search_normalized

Function to_search_normalized

library/MiscUtils.cpp:322–340  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

320};
321
322std::string to_search_normalized(const std::string &str)
323{
324 std::string result;
325 result.reserve(str.size());
326 for (char c : str)
327 {
328 const char *mapped = normalized_table[(uint8_t)c];
329 if (mapped == NULL)
330 result += tolower(c);
331 else
332 while (*mapped != '\0')
333 {
334 result += tolower(*mapped);
335 ++mapped;
336 }
337 }
338
339 return result;
340}
341
342std::string capitalize_string_words(const std::string& str)
343{ // Cleaned up from g_src/basics.cpp, and returns new string

Callers 4

toSearchNormalizedFunction · 0.85
tokenizeSearchMethod · 0.85
showEntryMethod · 0.85
filterDisplayMethod · 0.85

Calls 3

tolowerFunction · 0.85
reserveMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected