次の方法で共有


string Function (XML Query Language) (Windows Embedded CE 6.0)

1/6/2010

Converts an object to a string.

Syntax

            string string(object?)

Parameters

object

[optional] Object to be converted to a string.

Return Value

Converts the argument to a string based on the object type. See Remarks for further details.

Remarks

An object is converted to a string as follows.

A node-set is converted to a string by returning the string value of the node in the node-set that is first in document order. If the node-set is empty, an empty string is returned.

A number is converted to a string in the following ways:

  • NaN is converted to the string NaN.
  • Positive zero is converted to the string "0".
  • Negative zero is converted to the string "0".
  • Positive infinity is converted to the string "infinity".
  • Negative infinity is converted to the string "-infinity".
  • If the number is an integer, the number is represented in decimal form as a number with no decimal point and no leading zeros, preceded by a minus (-) if the number is negative.
  • Otherwise, the number is represented in decimal form as a number with a decimal point and at least one digit before the decimal point and at least one digit after the decimal point, preceded by a minus (-) if the number is negative; there must be no leading zeros before the decimal point, apart possibly from the one required digit immediately before the decimal point; beyond the one required digit after the decimal point there must be as many, but only as many, more digits as are needed to uniquely distinguish the number from all other IEEE 754 numeric values.

The Boolean "false" value is converted to the string "false". The Boolean "true" value is converted to the string "true".

An object of a type other than the four basic types is converted to a string 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 string function is not intended for converting numbers into strings for presentation to users. The format-number Function and <xsl:number> element in XSL Transformations (XSLT) provide this functionality.

See Also

Reference

XPath String Functions