I have two strings which I\'d like to compare: String and String:. Is there a library function that would return true when passed these two strings
String
String:
Easiest way is to use substr() and compare() member functions:
string str = "Foobar"; string prefix = "Foo"; if(str.substr(0, prefix.size()).compare(prefix) == 0) cout<<"Found!";