String.Split(","[0]) breaks on ios

I have a few utility functions that split up text strings into float values unfortunately they all break on ios. Is there another way to split a string on a char other than String.Split(“,”[0])

As far as I know there is nothing built into Unityscript that will do it… any other ideas?

static function quatParse (r : String) : Quaternion {
	
	var q : Quaternion;
	
	var values = r.Substring(1, r.Length - 2).Split(","[0]);
	q.x = floatParse(values[0]);
	q.y = floatParse(values[1]);
	q.z = floatParse(values[2]);
	q.w = floatParse(values[3]);
	return q;
}

this fails too using regex

static function splitString(phrase : String, split : String) : String[] {
	var regex : Regex = new Regex(split);
	var values : String[] = regex.Split(phrase);
	return values;
}

aaargh something so simple why is it so hard…

It seems the solution is to write the functions in c# not js… hmmm annoying.

There’s no reason they can’t be in JS, but there’s no such thing as “floatParse”. If you change that to parseFloat, it will work.

–Eric