mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:57:35 +00:00
AK: Support case-insensitive HashMap<String, T>.
We achieve this by allowing you to specify custom traits for the key type. For convenience, we also provide a CaseInsensitiveStringTraits for String.
This commit is contained in:
parent
b425de18cc
commit
d9d13f2445
4 changed files with 22 additions and 6 deletions
|
@ -32,5 +32,14 @@ int main()
|
|||
EXPECT(number_to_string.find(3) == number_to_string.end());
|
||||
|
||||
EXPECT_EQ(loop_counter, 3);
|
||||
|
||||
{
|
||||
HashMap<String, int, CaseInsensitiveStringTraits> casemap;
|
||||
EXPECT_EQ(String("nickserv").to_lowercase(), String("NickServ").to_lowercase());
|
||||
casemap.set("nickserv", 3);
|
||||
casemap.set("NickServ", 3);
|
||||
EXPECT_EQ(casemap.size(), 1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue