parseNumber: Difference between revisions
Jump to navigation
Jump to search
(add. classification) |
mNo edit summary |
||
Line 28: | Line 28: | ||
<!-- Note Section BEGIN --> | <!-- Note Section BEGIN --> | ||
* If the text does not represent a number ("abc" for example), parseNumber will return 0 (zero). It is therefore not possible to use parseNumber to determine if the string contains a valid number or not. | * If the text does not represent a number ("abc" for example), parseNumber will return 0 (zero). It is therefore not possible to use parseNumber to determine if the string contains a valid number or not. | ||
<strong>I beg to differ.</strong><br /> | |||
_stringNotContainingValidNumber = "abc"; | |||
if(parseNumber _stringNotContainingValidNumber == 0 && _stringNotContainingValidNumber != "0") then | |||
{ | |||
comment "INVALID NUMBER"; | |||
} | |||
else | |||
{ | |||
comment "VALID NUMBER"; | |||
}; | |||
[[User:MulleDK13|MulleDK13]] 09:26, 11 July 2010 (CEST) | |||
<!-- Note Section END --> | <!-- Note Section END --> | ||
</dl> | </dl> |
Revision as of 08:26, 11 July 2010
Description
- Description:
- Parse string containing real number.
- Groups:
- Uncategorised
Syntax
Examples
- Example 1:
- _number = parseNumber "0.125"
Additional Information
- See also:
- See also needed
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
Notes
- If the text does not represent a number ("abc" for example), parseNumber will return 0 (zero). It is therefore not possible to use parseNumber to determine if the string contains a valid number or not.
_stringNotContainingValidNumber = "abc"; if(parseNumber _stringNotContainingValidNumber == 0 && _stringNotContainingValidNumber != "0") then { comment "INVALID NUMBER"; } else { comment "VALID NUMBER"; }; MulleDK13 09:26, 11 July 2010 (CEST)