strtonum - convert string to number

 

SYNOPSIS

<strtonum $str>


DESCRIPTION
The strtonum function converts each of its string arguments to a numeric (double) value. The strings may be any text quantity that NPM (Metamorph's Numeric Pattern Matcher) can parse.


DIAGNOSTICS
strtonum returns the double numeric value of each of its string arguments, or 0 if unparseable.


EXAMPLE

<$txt = "one thousand nine hundred ninety eight"
          "four score and seven years ago"
          "1/3"   "3.14"   "one hundred percent"
          "two thousandths"
          "nine and a half">
  <strtonum $txt>
  <LOOP $ret> $ret </LOOP>

The output would be:

1998 87 0.333333 3.14 1 0.002 9.5


CAVEATS
The strtonum function was added in version 2.1.876800000 19971014.


SEE ALSO
sum


Copyright © Thunderstone Software     Last updated: Sep 25 2019
Copyright © 2019 Thunderstone Software LLC. All rights reserved.