0

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.

5

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.