StringToFixed
native fixed StringToFixed(string value);
Convert a string to a fixed
Parameters
- string value
String value. Can be of one of these forms:
- Dot notation: "-10.5" -> -10.5
- Exponential Notation: "1e5" -> 100 000
- Trim spaces: " -10 " -> -10
Return value
fixed - The string value converted to a fixed or 0 if it cannot be converted
Examples
- Example #1: Allowed conversion
fixed f; f = StringToFixed("-10.5"); // f = -10.5; f = StringToFixed("1e5"); // f = 100 000 f = StringToFixed(" 1 "); // f = 1
- Example #2: Disallowed conversion
f = StringToFixed("123a"); // f = 0 f = StringToFixed("sc2mapster"); // f = 0