Find the first occurrence of a sequence in this string.

Synopsis

Declared in <bslstl_string.h>

size_type
find(
    basic_string const& substring,
    size_type position = 0) const noexcept;

Description

Return the starting position of the first occurrence of the specified substring, if such a substring can be found in this string (on or after the optionally specified position if such a position is specified) using CHAR_TRAITS::eq to compare characters, and return npos otherwise.

Return Value

position of the match, or npos if not found

Parameters

Name

Description

substring

substring to search for

position

starting index

Created with MrDocs