This might be very simple, Even I was also thinking as the method name is "containskey" then it should return true if partial matches, unfortunately it is not like that. "Containskey" method will return true only if key is exact match.
It is also case sensitive. Below is some code snippet
map<string,string> test = new map<string,string>();
test.put('abc123','GM');
system.debug('Exact matches -abc123 -'+test.ContainsKey('abc123'));---- True
system.debug('Partial matches-123--'+test.ContainsKey('123')); --- False
system.debug('Partial matches-abc--'+test.ContainsKey('abc')); --- False
system.debug('Case sensitive matches-ABC123-- '+test.ContainsKey('ABC123')); --- False
It is also case sensitive. Below is some code snippet
map<string,string> test = new map<string,string>();
test.put('abc123','GM');
system.debug('Exact matches -abc123 -'+test.ContainsKey('abc123'));---- True
system.debug('Partial matches-123--'+test.ContainsKey('123')); --- False
system.debug('Partial matches-abc--'+test.ContainsKey('abc')); --- False
system.debug('Case sensitive matches-ABC123-- '+test.ContainsKey('ABC123')); --- False
No comments:
Post a Comment