I am trying to split a string into a list of values, by splitting it by a given character. I need it to be a list rather than an array because the number of values can change. How would I go about doing this?
For example:
String s = "red, green, blue, unicorn";
would become a list where the element at index 0 is red, then 1 is green, etc.
Assuming your string is comma delimited: