This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)


gives the number of characters in a string.
  • StringLength counts special characters such as as single characters, even if their full names involve many characters.
Find the number of characters in a string:
Find the number of characters in a string:
Click for copyable input
Find lengths of all strings in a list:
StringLength treats special characters just like ordinary ones:
Newlines count as one character:
Find the growth rate of a string substitution system:
The empty string has zero length:
Formatting constructs are included in giving lengths of formatted strings:
StringLength counts every character as length 1, regardless of the length of its full name:
New in 1 | Last modified in 5.1