---
title: string-length
slug: Web/XPath/Functions/string-length
tags:
  - XSLT
  - XSLT_Reference
---
{{ XsltRef() }}

The `string-length` function returns a number equal to the number of characters in a given string.

### Syntax

    string-length( [string] )

### Arguments

- _`string`_(optional)
  - : The string to evaluate. If omitted, string used will be the same as the context node converted to a string.

### Returns

An integer equal to the number of characters in the string.

### Defined

[XPath 1.0 4.2](https://www.w3.org/TR/xpath#function-string-length)

### Gecko support

Supported.
