+ 2

How to check if a word starts with "amend"

3rd Dec 2016, 1:19 PM
RAJDEEP DAS
RAJDEEP DAS - avatar
3 odpowiedzi
0
Java class String has method startsWith. String t = "amendish"; boolean res = t.startsWith("amend"); // res is TRUE
3rd Dec 2016, 1:51 PM
Ondřej Doněk
Ondřej Doněk - avatar
0
can you help we with it in c++?
3rd Dec 2016, 1:52 PM
RAJDEEP DAS
RAJDEEP DAS - avatar
0
In C++ you can use strncmp string t = "amendish"; string s = "amend"; int res = strncmp(t, s, strlen(s)); // res is 0 http://www.cplusplus.com/reference/cstring/strncmp
3rd Dec 2016, 1:55 PM
Ondřej Doněk
Ondřej Doněk - avatar