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
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