24 Strings library [strings]

24.3 String classes [string.classes]

24.3.2 Class template basic_­string [basic.string] basic_­string string operations [string.ops] basic_­string​::​find [string.find]

size_type find(basic_string_view<charT, traits> sv, size_type pos = 0) const noexcept;

Effects: Determines the lowest position xpos, if possible, such that both of the following conditions hold:

  • pos <= xpos and xpos + sv.size() <= size();

  • traits​::​eq(at(xpos + I), sv.at(I)) for all elements I of the data referenced by sv.

Returns: xpos if the function can determine such a value for xpos. Otherwise, returns npos.

size_type find(const basic_string& str, size_type pos = 0) const noexcept;

Effects: Equivalent to: return find(basic_­string_­view<charT, traits>(str), pos);

size_type find(const charT* s, size_type pos, size_type n) const;

Returns: find(basic_­string_­view<charT, traits>(s, n), pos).

size_type find(const charT* s, size_type pos = 0) const;

Requires: s points to an array of at least traits​::​length(s) + 1 elements of charT.

Returns: find(basic_­string_­view<charT, traits>(s), pos).

size_type find(charT c, size_type pos = 0) const;

Returns: find(basic_­string(1, c), pos).