You can use Split.
ex:
string allCodes = "G10,M8,X5,Y5";
// this splits the string using comma as a parameter.
// every index on the array will now have a code in it.
// note that this method requires you to use a single ' instead of "
string[] codes = allCodes.Split(',');
// prints on the screen all the codes
foreach(string current in codes)
{
Debug.Log(current);
}
↧