bsl::basic_string::find

Find the first occurrence of a character in this string.

Synopsis

Declared in <bslstl_string.h>

size_type
find(
    CHAR_TYPE character,
    size_type position = 0) const;

Description

Return the position of the first occurrence of the specified character, if such an occurrence can be found in this string (on or after the optionally specified position if such a position is specified), and return npos otherwise.

Return Value

position of the match, or npos if not found

Parameters

NameDescription
charactercharacter to search for
positionindex at which to start the search