StrToI(str as String) as Dynamic
Return the integer value of the string, or invalid if str is not a string.
"EnTerr" wrote:
Also, when speaking of conversion string -> int, what are the differences between strtoi(str), string.toint() and val(str, 10)?
"EnTerr" wrote:
i tried using StrToI and noticed it does not behave as advertised:
"EnTerr" wrote:
how am i supposed to determine if a string is actually a proper number?
function isProperNumber(s as dynamic) as boolean
isProper = false
if GetInterface(s, "ifString") <> invalid
re = CreateObject("roRegex", "^\s*[+-]?\d+$", "")
if re.IsMatch(s)
isProper = true
end if
end if
return isProper
end function
"belltown" wrote:"EnTerr" wrote:
how am i supposed to determine if a string is actually a proper number?
Define what you mean by a 'proper number' and use a regular expression to check for that
Brightscript Debugger> ? val("0x123456")