Skip to content

StringLength ​

The number of characters in s.

✓ checked against that system · ! checked, with disagreements (hover a chip)Wolfram LanguageStringLength✓
StringLength(s)the number of Unicode code points in s
Typed signatures
TypePackageApplies
(string) -> integercombinatoricsalways

Domain: Collections

Details
  • Counts code points, not UTF-16 units: a😀b has 3, not 4 (the emoji is one code point represented as two UTF-16 units) — same convention as ToCharacterCode and compute-engine's own Characters.

Examples

Basic #
live ↗
InStringLength(a😀b)\mathrm{StringLength}(\text{\text{a😀b}})Out33

Counts characters

live ↗
InStringLength(tiger)\mathrm{StringLength}(\text{tiger})Out55
Properties #

The empty string has length zero

live ↗
InStringLength()\mathrm{StringLength}(\text{})Out00
About
Examples3
Checked againstWolfram Language 3 agree
CrosswalkWolfram Language

See also: StringTake, ToCharacterCode