String: NPOs --- STL

Source: Internet
Author: User

In CPP primer, the find method returns a special value named string: NPOs, indicating that the search does not match. Stick on for memory.

TheStringClass provides six search functions, each named as a variantFind. The operations all returnString: size_typeValue that is the index of where the match occurred, or a special value namedString: NPOsIf there is no match.StringClass definesNPOsAs a value that is guaranteed to be greater than any valid index.

 

The string class provides six search functions, each of which is named in different forms of find. All these operations return values of the string: size_type type. The following mark is used to locate the matched position. Alternatively, a special value named string: NPOs is returned, indicating that no matching is found. The string class defines NPOs as a value that must be greater than any valid lower-level value.

For example:

String STR;

Pos = Str. find_first_of ("H ");

If (Pos! = String: NPOs)

{..

....

}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.