std::string::compare() in C++ with Examples
The std::string::compare() function in C++ is used to compare two strings lexicographically. It is a member function of the std::string class defined in the <string> header. The function returns an integer value that indicates the relationship between the two strings being compared. Syntax: int compare(const string& str) const; int compare(const char* s) const; int compare(size_t …