parseNumber – Talk

From Bohemia Interactive Community
Revision as of 15:12, 13 July 2010 by Kronzky (talk | contribs) (Please use the talk page for discussions)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
  • 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)