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
Use this.
String commaValue = '123, 234, 345, 456, 567';
List<String> splitted = commaValue.split(',');
System.debug(splitted.size());
//Result would be 5
You can convert it to integer using valueOf method.