Logo

Programming-Idioms

History of Idiom 169 > diff from v17 to v18

Edit summary for version 18 by abertk:
New D implementation by user [abertk]

Version 17

2018-02-04, 16:55:39

Version 18

2018-02-04, 16:56:58

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;
Code
string s;
size_t n = s.walkLength;
Comments bubble
n is the count of UTF-8 code points.