Logo

Programming-Idioms

History of Idiom 169 > diff from v20 to v21

Edit summary for version 21 by programming-idioms.org:
[D] No need to declare s in code

Version 20

2018-02-05, 11:19:33

Version 21

2018-02-05, 11:19:45

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.

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.

Extra Keywords
size
Extra Keywords
size
Imports
std.range;
Imports
std.range;
Code
string s;
size_t n = s.walkLength;
Code
size_t n = s.walkLength;
Comments bubble
n is the count of UTF-8 code points.
Comments bubble
n is the count of UTF-8 code points.