Function that makes String "Level1" into Int "1"

i used to do that in PHP before i stopped developing for a long time, i hope that the question is clear

Thanks

JS User

If it’s always “Level~” (~ being some number) then you could just get all the characters between the fifth position and the end of the string and then convert them to int via something like int.Parse (see http://docs.unity3d.com/Documentation/ScriptReference/String.html for more info) . Something like this should work…

var level : String = "Level1";
var number : String = level.substring(5,level.Length-1);
var nr : int = int.Parse(number);

Chances are that the syntax is incorrect, mostly when it comes to the SubString part , but you should get the idea