+ Start a Discussion
Vishal Tiwari 36Vishal Tiwari 36 

Creating string from Custom label

I have a custom label in CSV format called Test having value abc, xyz and I want to create a string in the form 'abc','xyz'. How would we do that?

String str = System.Label.Test;
 
Best Answer chosen by Vishal Tiwari 36
Rishab Wali 3Rishab Wali 3
Hi Vishal ,

You can get the value in a string and use the split() method to get the values in a list<String>.
Then manipulate the strings in the way you want.

Example - String labelString = System.Label.Test;
                  List<String> csvStrings = labelString.split(',');

                  for(String str : csvStrings)
                  {
                      //  Your logic here
                  }

Thanks & Regards
Rishab Wali