Logo

Programming-Idioms

History of Idiom 169 > diff from v50 to v51

Edit summary for version 51 by programming-idioms.org:
Admin deletes impl 2219

Version 50

2018-10-01, 20:50:16

Version 51

2018-10-01, 20:54:38

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.

Illustration

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.

Illustration
Extra Keywords
size characters chars number runes
Extra Keywords
size characters chars number runes
Imports
#include <string>
Code
int n = s.length();
Comments bubble
s is a std::string
Doc URL
http://www.cplusplus.com/reference/string/string/length/