0
Substring of string find problem
Hey there. I have a string and want to check if a specific substring is part of that string and if so, print it or if not, say sth like not part of string. Well, I'm having some difficulties here because I'm still trying to comprehend the basics ;) See code... https://code.sololearn.com/c01NmSRjwbWJ/#cpp
2 ответов
+ 3
You need to add a prompt before creating the substring. If the string is not found, you can’t create a substring starting from npos
if (found == npos)
// string not found
else
// string found, create substring
0
Thank you!