function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Case insensitivity with mapkeys.

Hi All,
I have one simple map like below.
Map<string,string> keyAndValues = new Map<string,string>();

Now i want to check whether the string 'abcd' exists in Keys of Map or not.
I ll write like this,
    system.debug('Key exists in map');

Here It will return false as it ll check with case sensitivity.

But i want to ignore case sensitivity and want to search vth case insensivity.Is there any way to do like this.
If any one have idea please let me know.

Thanks in Advance.

Best Answer chosen by Rajus
Hi Rajesh ,
Map keys are case sensitive , you have to choose a format if you want case insensivity  for e.g.

use tolowercase() while putting and searching in Map
Map<string,string> keyAndValues = new Map<string,string>();
String key1='ABcd';


    system.debug('Key exists in map');