updating oE hex_text
hex_text
include std/convert.e default namespace is convert public function hex_text(sequence text)
Converts a text representation of a hexadecimal number to an atom.
Parameters:
- text : the text to convert.
Returns:
An atom, the numeric equivalent to text
Comments:
- The text can optionally begin with '#' which is ignored.
- The text can have any number of underscores, all of which are ignored.
- The text can have one leading '-', indicating a negative number.
- The text can have any number of underscores, all of which are ignored.
- Any other characters in the text stops the parsing and returns the value thus far.
Example 1:
include std/console.e -- for convert function include std/convert.e -- for display function atom h1 = hex_text("-#3_4FA.00E_1BD") ? h1 display("H1 is:[]",h1) -- note the difference in significant digits using ? vs display() atom h2 = hex_text("DEAD_BEEF") ? h2 display("H2 is:[]",h2)
Results:
-13562.00344 H1 is:-13562.0034444928 3735928559 H2 is:3735928559
See Also:
Not Categorized, Please Help
|