I Have a text field wich contains data like 123, 234, 345, 456, 567. I now want to put this data in a list. It needs some sort of loop that gets the first 3 digits on the left side of the comma. I can't figure out how to do this. any tips?


1 Answer 1


Use this.

String commaValue = '123, 234, 345, 456, 567';
List<String> splitted = commaValue.split(',');
//Result would be 5

You can convert it to integer using valueOf method.

You must log in to answer this question.

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