MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / StrTrimView

Function StrTrimView

src/string.cpp:241–249  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

239}
240
241std::string_view StrTrimView(std::string_view str, std::string_view characters_to_trim)
242{
243 size_t first_pos = str.find_first_not_of(characters_to_trim);
244 if (first_pos == std::string::npos) {
245 return std::string_view{};
246 }
247 size_t last_pos = str.find_last_not_of(characters_to_trim);
248 return str.substr(first_pos, last_pos - first_pos + 1);
249}
250
251/**
252 * Check whether the given string starts with the given prefix, ignoring case.

Callers 8

GetSuggestionsMethod · 0.85
LoadFromDiskMethod · 0.85
ConClientNickChangeFunction · 0.85
ParseCodeFunction · 0.85
ReadRawLanguageStringsFunction · 0.85
HandleStringMethod · 0.85
ParseFileMethod · 0.85
string_func.cppFile · 0.85

Calls 1

substrMethod · 0.80

Tested by

no test coverage detected