CCalclabhub

Text & Writing

Character length

The length of a string is the count of its code units, which includes spaces, punctuation and line breaks but counts an emoji as more than one.

The Formula

characters = number of code units in the string

The length of a string is the count of its code units, which includes spaces, punctuation and line breaks but counts an emoji as more than one.

SymbolMeaning
sText
CCharacter count

What Each Symbol Means

sstring

Text

The string being measured.

Ccharacters

Character count

How many code units the string contains.

See It Worked With Real Numbers

A formula on its own does not tell you which number goes where. The how to count characters page applies this equation to a concrete case, shows every intermediate step, and names the mistakes that produce a wrong answer even when the algebra is right.

Where This Formula Appears

This equation is the working core of How To Count Characters, filed under Everyday Life. Every number the guide produces comes from substituting into this one line.