readonly float String.AsFloat;
Converts the string into a float, and returns that value. Returns
0.0 if the string does not contain a number.
Example:
String text1, text2;
float number1,number2;
text1 = "57.362";
text2 = "Hello";
number1 = text1.AsFloat;
number2 = text2.AsFloat;
will set number1 value to 57.362 and number2 value to 0.0
This function is useful for processing strings input from the user.
NOTE: To convert a float to a string, you can use the String.Format
command.
See Also: Game.InputBox,
String.AsInt,
String.Format
|