Core Function Dec
From Sputnik Wiki
(Difference between revisions)
(Created page with "<pre> Dec( <expression> ) </pre> === Description === Returns a integer representation of a hexadecimal string. === Parameters === ==== expression ==== The hexadecimal string...") |
(→Remarks) |
||
Line 21: | Line 21: | ||
=== Remarks === | === Remarks === | ||
− | The function only works with numbers that fit in a 32 bit signed | + | The function only works with numbers that fit in a 32 bit signed integer. |
=== Example === | === Example === |
Revision as of 07:02, 11 November 2011
Dec( <expression> )
Contents |
Description
Returns a integer representation of a hexadecimal string.
Parameters
expression
The hexadecimal string to convert.
Return Value
Success: Returns an integer.
Failure: Returns 0.
Remarks
The function only works with numbers that fit in a 32 bit signed integer.
Example
$result = Hex(1033) println($result) ; prints "409" $result = Hex(1033, 4) println($result) ; prints "0409" $result = Hex(1033, 8) println($result) ; prints "00000409"
Example with cast on a $variable
$var = 1033 $result = Hex((int)$var) println($result) ; prints "409" $result = Hex((int)$var, 4) println($result) ; prints "0409" $result = Hex((int)$var, 8) println($result) ; prints "00000409"