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.


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


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

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.