strlen()

Returns the length, in characters, of the input string.

Note

This function counts Unicode code points.

Syntax

strlen(source)

Learn more about syntax conventions.

Parameters

Name Type Required Description
source string ✔️ The string for which to return the length.

Returns

Returns the length, in characters, of the input string.

Examples

String of letters

print length = strlen("hello")

Output

length
5

String of letters and symbols

print length = strlen("⒦⒰⒮⒯⒪")

Output

length
5

String with grapheme

print strlen('Çedilla') // the first character is a grapheme cluster
                        // that requires 2 code points to represent

Output

length
8