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.size
n = s.length
int n = s.Length;
size_t n = s.length;
size_t n = s.walkLength;
import std.uni, std.range;
size_t n = s.byGrapheme.walkLength;
int n = s.length;
n = String.length s
import "unicode/utf8"
n := utf8.RuneCountInString(s)
n = length s
var n = s.length;
int n = s.length();
local n = utf8.len(s)
$n = mb_strlen($s, 'UTF-8');
uses sysutils;
n := s.length;
uses LazUtf8;
n := Utf8Length(s);
uses LazUtf8;
n := length(s);
my $n = length( $s );
n = len(s)
let n = s.chars().count();
val n = s.length()

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

Idiom created by