• source navigation  • diff markup  • identifier search  • freetext search  • 

Sources/ucode/tests/custom/03_stdlib/07_hex

  1 The `hex()` function converts the given hexadecimal string into a signed
  2 integer value and returns the resulting number.
  3 
  4 Returns `NaN` if the given argument is not a string, an empty string or
  5 a string containing non-hexadecimal digits.
  6 
  7 -- Testcase --
  8 {%
  9         printf("%.J\n", [
 10                 hex(),
 11                 hex(false),
 12                 hex(123),
 13                 hex(""),
 14                 hex("invalid"),
 15                 hex("deaf"),
 16                 hex("0x1000"),
 17                 hex("ffffffffffffffff")
 18         ]);
 19 %}
 20 -- End --
 21 
 22 -- Expect stdout --
 23 [
 24         "NaN",
 25         "NaN",
 26         "NaN",
 27         "NaN",
 28         "NaN",
 29         57007,
 30         4096,
 31         9223372036854775807
 32 ]
 33 -- End --

This page was automatically generated by LXR 0.3.1.  •  OpenWrt