Logo

Programming-Idioms

History of Idiom 46 > diff from v28 to v29

Edit summary for version 29 by :
New Cpp implementation by user [GhassanPL]

Version 28

2016-02-16, 17:21:02

Version 29

2016-02-16, 18:01:28

Idiom #46 Extract beginning of string (prefix)

Create string t consisting of the 5 first characters of string s.

Idiom #46 Extract beginning of string (prefix)

Create string t consisting of the 5 first characters of string s.

Code
auto t = s.substr(0, 5);
Doc URL
http://www.cplusplus.com/reference/string/string/substr/