- Home /
Question by
Clockwork Fromage · Feb 19, 2012 at 12:02 AM ·
stringstring.split
turning the string x32y45 into (32,45)
the title says it all , i know how to go one way and now i need to figure out the other how do i turn the string x32y45 into (32,45) using c#
is it possible to do this using sring.split without using an array for efficiency purposes?
the string should sometime come up as x0y10 and is always an integer
by the way if you are wondering why this is , i am trying not to need an array for my coordinate since it would be a 10000 item array of game object and would take several seconds to generate , this is all for a work-around
Comment
Best Answer
Answer by Berenger · Feb 19, 2012 at 12:35 AM
That works. Maybe there is a faster way ?
string str = "x32y45";
int y = str.IndexOf("y");
print( "("+ str.Substring( 1, y-1 ) + "," + str.Substring( y+1, str.Length-y-1 )+")" );
Your answer
![](https://koobas.hobune.stream/wayback/20220613064228im_/https://answers.unity.com/themes/thub/images/avi.jpg)