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
AKumAKum 

String comparison is failing in Salesforce ?

Hi Guys,

  • We are having some weird issue while comparing two strings in apex class :
  • We have a list of strings in which we store csv file headers after parsing that in salesforce.
  • Then we compare each of these headers value in salesforce . In some situation we are getting same debug's for both string values but
  • The check of STRING.EQUALSIGNORECASE is failing.
  • I have assumed that the value in either of the string may contain some garbage or value of other type but not sure .
Thanks !
NagendraNagendra (Salesforce Developers) 
Hi Akum,

Although "EQUALSIGNORECASE" is not case sensitive, it is whitespace sensitive. Try trimming your strings before comparing them.
.trim()
Hope this helps.

Kindly mark this as solved if the reply was helpful.

Thanks,
Nagendra