sourcemod icon indicating copy to clipboard operation
sourcemod copied to clipboard

Implement StringMap.IgnoreCase

Open dragokas opened this issue 3 years ago • 3 comments

Please, add the option to be able ignore case sensitivity of StringMap key.

dragokas avatar Feb 15 '22 19:02 dragokas

StringMap hash system may not provide for case insensitivity. It is possible to use when adding and reading elements using only lower or upper case

Wend4r avatar Feb 15 '22 21:02 Wend4r

like most implementations we could tolower the keys, although that would result in unexpected behaviour on the keys.

Why is this desired? what's the use-case?

KyleSanderson avatar Feb 28 '22 05:02 KyleSanderson

Well, my case is using StringMap object to cache some stuff related to #phrases. Source Engine uses case insensitive look up for it, so I must mimic. At the moment I do CharToLower to store and retrieve StringMap values, but that's an additional performance consumption which could be done by setup new .IgnoreCase property of StringMap beforehand. I met other use-cases, but don't remember already.

dragokas avatar Feb 28 '22 14:02 dragokas