Friday, June 19, 2020

Converting list of string to list of lowercase in Apex

This post explains how to convert a list of strings to a list of Lowercase .


To convert a list of strings to a list of lowercase , you just need to run a loop over the list and use the "toLowerCase()"  method.



public class TolowerCase {
    public static void Cases()
    {
        List<String> Values = new List<String>{'SALES', 'MARKETING', 'SERVICE'};
            
            for(String s : Values)
        {
                s.toLowerCase();
                System.debug('OrignalWord------>>'+s);
                System.debug('LowerCaseWord------>>' + s.toLowerCase());
              
            }
    }
}


Result :-  




Easy right..........!!

Thanks,
Lovesalesforceyes


No comments:

Post a Comment

Get selected radio button value in LWC

This post explains how to get selected radio button in LWC. Below is demo of output : To use the radio button in LWC you have to use the  li...