parseNumber – Talk
Jump to navigation
Jump to search
(Please use the talk page for discussions) |
Lou Montana (talk | contribs) m (Text replacement - "<code>" to "<code style="display: block">") |
||
(5 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
* 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 | <strong>I beg to differ.</strong><br> | ||
_stringNotContainingValidNumber = "abc"; | _stringNotContainingValidNumber = "abc"; | ||
if(parseNumber _stringNotContainingValidNumber == 0 && _stringNotContainingValidNumber != "0") then | if(parseNumber _stringNotContainingValidNumber == 0 && _stringNotContainingValidNumber != "0") then | ||
Line 12: | Line 12: | ||
}; | }; | ||
[[User:MulleDK13|MulleDK13]] 09:26, 11 July 2010 (CEST) | [[User:MulleDK13|MulleDK13]] 09:26, 11 July 2010 (CEST) | ||
== Huh? == | |||
Those past 3 edits make my head hurt. where did that old note come from? It went, it came, it went again... --[[User:Benargee|Benargee]] ([[User talk:Benargee|talk]]) 00:47, 3 October 2014 (CEST) | |||
<dl class="command_description"> | |||
<dt></dt> | |||
<dd class="notedate">Posted on October 3, 2014 - 22:21 (UTC)</dd> | |||
<dt class="note">[[User:DreadedEntity|DreadedEntity]]</dt> | |||
<dd class="note"> | |||
When trying to parse a string from an array, be sure to properly use parenthesis.<br> | |||
<code style="display: block">parseNumber _array select 0; '''//""Error Generic error in expression"", position: _array |#|select 0''' | |||
hint format["%1", parseNumber _array select 0]; '''//"Error Generic error in expression", pos: _array |#|select 0<br>''' | |||
parseNumber (_array select 0); '''//No error'''</code> | |||
</dd> | |||
</dl> |
Latest revision as of 11:53, 11 January 2023
- 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.
I beg to differ.
_stringNotContainingValidNumber = "abc"; if(parseNumber _stringNotContainingValidNumber == 0 && _stringNotContainingValidNumber != "0") then { comment "INVALID NUMBER"; } else { comment "VALID NUMBER"; };
MulleDK13 09:26, 11 July 2010 (CEST)
Huh?
Those past 3 edits make my head hurt. where did that old note come from? It went, it came, it went again... --Benargee (talk) 00:47, 3 October 2014 (CEST)
- Posted on October 3, 2014 - 22:21 (UTC)
- DreadedEntity
-
When trying to parse a string from an array, be sure to properly use parenthesis.
parseNumber _array select 0; //""Error Generic error in expression"", position: _array |#|select 0 hint format["%1", parseNumber _array select 0]; //"Error Generic error in expression", pos: _array |#|select 0
parseNumber (_array select 0); //No error