Griffo
1
How do I just get the number out of a string?
I know how to get the number from a string like below.
var myInt: int = System.Int32.Parse("3289"); print(myInt);
But how would I do this?
var myInt: int = System.Int32.Parse("I want this 3289"); print(myInt);
Something like this would do it:
function ConvertToInt(stringContainingNumber : String) : int
{
return System.Convert.ToInt32(stringContainingNumber.Substring(stringContainingNumber.ToList().FindIndex(function(c) char.IsDigit(c))));
}
You would need to add import System.Linq to the top of the file with that routine.