1

How can I convert a String of that type : 123, 456, 789

into a List<String> ? So I can access to the value 123 for example.

1 Answer 1

7

Use split method. this method will split the string using provided regex.

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_string.htm

String str = '123, 456, 789';
List<String> lstString = str.split(',');
System.debug('-----lstString----'+lstString);

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .