The ends function in C checks whether the end of a string matches the given string. Syntax: bool ends(const string& str) const; Parameters: str - the string to match Return value: true if the string ends with the given string, false otherwise.
The meaning of ends in C
ends is a member function of the string class in the C standard library. What it does is check if the end of the string matches the given string.
Syntax
<code class="cpp">bool ends(const string& str) const;</code>
Parameters
: String to match
Return Value
Returns true if the string ends with the given string, false otherwise.Usage
#ends function can be used to check whether a string contains a specific end. For example, the following code checks whether the string "hello" ends with "lo":<code class="cpp">string str = "hello"; bool isEnding = str.ends("lo");</code>
The difference between ends_with
ends is similar to the ends_with function, but there are two main differences:The above is the detailed content of What does ends mean in c++. For more information, please follow other related articles on the PHP Chinese website!