If your IP addresses are separated only by commas, and the comma-delimited strings contain only IP addresses, split() will do the job nicely. If there are things other than IP addresses in the input string, or if (as in your example string) you have empty strings, you will need to sanity-check the output from split().