(Formerly known as global function StringToInt, which is now obsolete)
readonly int String.AsInt;
Converts the string into an integer, and returns that value. Returns
zero if the string does not contain a number.
Example:
String text1, text2;
int number1,number2;
text1 = "53";
text2 = "Hello";
number1 = text1.AsInt;
number2 = text2.AsInt;
will set number1 value to 53 and number2 value to 0.
This function is useful for processing strings input from the user.
NOTE: To convert an integer to a string, you can use the String.Format
command.
See Also: Game.InputBox, String.AsFloat,
String.Format
|