+ 2

Is it possible to cut string?

like string str = "Hello", str2; //And i want to str2 = "ell"(2,3,4 words of str)?

4th Jun 2018, 9:51 AM
Ixidot
Ixidot - avatar
3 Respuestas
4th Jun 2018, 9:59 AM
Muhd Khairul Amirin
Muhd Khairul Amirin - avatar
+ 6
You can just extract what you want from str1 and store it in str2. http://www.cplusplus.com/reference/string/string/substr/
4th Jun 2018, 9:58 AM
Dev
Dev - avatar
0
you can use the substring method as: str.substring(startIndex,endIndex) Note that Index starts from 0 and also keep in mind that startIndex is inclusive where as endIndex is exclusive.
13th Jun 2018, 11:59 AM
Debjit Mukherjee
Debjit Mukherjee - avatar