<div class="meta" robots="noindex">

</div>

Method

# Len

<div class="warning">

<div class="title">

Warning

</div>

This item was deprecated in version 2019r2. Please use `String.Length<string.length>` as a replacement.

</div>

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

Returns the number of characters in the specified `string</api/data_types/string>`.

## Usage

``` xojo
result = Len(source)
```

**OR**

``` xojo
result = sourceVariable.Len
```

| Part           | Type                               | Description                                            |
|----------------|------------------------------------|--------------------------------------------------------|
| result         | `Integer</api/data_types/integer>` | The number of characters in *string*.                  |
| source         | `String</api/data_types/string>`   | Any valid string expression.                           |
| sourceVariable | `String</api/data_types/string>`   | Any variable of type `String</api/data_types/string>`. |

## Notes

If you need the number of bytes in the `string</api/data_types/string>` rather than the number of characters, use the `String.Bytes<string.bytes>` function.

## Sample code

This example uses the <span class="title-ref">Len</span> function to return the number of characters in a string.

``` xojo
Var n As Integer
n = Len("Hello world") ' returns 11
Var s As String
s = "Hello World"
n = s.Len ' returns 11
```

## Compatibility

All project types on all supported operating systems.

## See also

`Asc</api/math/asc>`, `Chr</api/text/chr>`, `String.IndexOf<string.indexof>`, `String.Bytes<string.bytes>`, `String.Middle<string.middle>`, `String.Right<string.right>` functions.
