Skip to content

len

Number of characters in a string.

v = len(text)

Returns the number of characters in text. Treats every character as one unit, regardless of byte width. For byte-counting (multi-byte characters counted by their byte length), use lenb.

len('hello') % 5
  • lenb — Number of bytes in a string.
  • left — First N characters of a string.
  • right — Last N characters of a string.
  • mid — Substring starting at a given position.