Changeset - r27306:41a10e41285c
[Not reviewed]
master
0 1 0
Rubidium - 16 months ago 2023-05-05 11:58:59
rubidium@openttd.org
Add: case insensitive string comparator
1 file changed with 5 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/string_func.h
Show inline comments
 
@@ -60,6 +60,11 @@ void StrTrimInPlace(std::string &str);
 
[[nodiscard]] bool StrEqualsIgnoreCase(const std::string_view str1, const std::string_view str2);
 
[[nodiscard]] int StrNaturalCompare(std::string_view s1, std::string_view s2, bool ignore_garbage_at_front = false);
 

	
 
/** Case insensitive comparator for strings, for example for use in std::map. */
 
struct CaseInsensitiveComparator {
 
	bool operator()(const std::string_view s1, const std::string_view s2) const { return StrCompareIgnoreCase(s1, s2) < 0; }
 
};
 

	
 
/**
 
 * Check if a string buffer is empty.
 
 *
0 comments (0 inline, 0 general)