This language bar is your friend. Select your favorite languages!

Idiom #169 String length

Assign to integer n the number of characters of string s.

This can be different from the number of bytes of s.

n = s.length
int n = s.length;
import "unicode/utf8"
n := utf8.RuneCountInString(s)
var n = s.length;
int n = s.length();
uses LazUtf8;
n := length(s); //single byte encoding or widestring, plain pascal
n := Utf8Length(s); //UTF8-encoding, as used in Lazarus

Do you know the best way to do this in your language ?
New implementation...

Idiom created by