-
Notifications
You must be signed in to change notification settings - Fork 22.4k
/
index.md
46 lines (31 loc) · 1.07 KB
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
---
title: string
slug: Web/XPath/Functions/string
page-type: xpath-function
---
{{XsltSidebar}}
The `string` function converts the given argument to a string.
## Syntax
```plain
string( [object] )
```
### Parameters
- `object` (optional)
- : The object to convert to a string. If omitted, the context node is used.
### Return value
A string
## Description
- If the object is a node-set, the string value of the first node in the set is returned.
- A number is converted as follows:
- 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.
- Decimal numbers between -1 and 1 are converted to a string with a single leading 0 before the decimal point.
- Boolean true is converted to the string true.
- Boolean false is converted to the string false.
## Specifications
[XPath 1.0 4.2](https://www.w3.org/TR/1999/REC-xpath-19991116/#function-string)
## Gecko support
Supported.