Partager via


number Function (Windows Embedded CE 6.0)

1/6/2010

Converts the argument to a number.

Syntax

            number number(object?)

Parameters

  • object
    [optional] An object to be converted to a number.

Return Value

Converts its argument to a number as shown in the following list:

  • A string that consists of optional white space followed by an optional minus sign followed by a number followed by white space is converted to the IEEE 754 number that is nearest (according to the IEEE 754 round-to-nearest rule) to the mathematical value represented by the string; any other string is converted to NaN.
  • Boolean True is converted to 1; Boolean False is converted to 0.
  • A node set is first converted to a string and then converted in the same way as a string argument.
  • An object of a type other than the four basic types (node-set, Boolean, number, or string) is converted to a number in a way that is dependent on that type.

If the argument is omitted, it defaults to a node set with the context node as its only member.

Note

The number function should not be used for conversion of numeric data occurring in an element in an XML document unless the element is of a type that represents numeric data in a language-neutral format (that would typically be transformed into a language-specific format for presentation to a user). In addition, the number function cannot be used unless the language-neutral format used by the element is consistent with the XML Path Language (XPath) syntax for a number.

See Also

Reference

XPath Number Functions