What would be the most elegant way to extract values from a string of comma-separated numbers?
It should account for whitespaces too. Example:
Input string: "22,10,8,13"
Input string: "22, 10, 8, 13"
Input string: "22, 10 ,8 ,13,"
Given all three inputs, the method should recognise the values.
Example output for all three inputs: "String contains: 22 10 8 13"
Possible duplicate: Easiest way to parse a comma delimited string to some kind of object I can loop through to access the individual values?