text
stringlengths 0
2.2M
|
---|
}
|
size_type string_view::find(const_pointer str, size_type pos,
|
size_type n) const noexcept {
|
return find(string_view{str, n}, pos);
|
}
|
size_type string_view::find(const_pointer str, size_type pos) const noexcept {
|
return find(string_view{str, strlen(str)}, pos);
|
}
|
size_type string_view::rfind(string_view str, size_type pos) const noexcept {
|
if (size() < str.size())
|
return npos;
|
if (str.empty())
|
return std::min(size(), pos);
|
string_view tmp{data_, std::min(size() - str.size(), pos) + str.size()};
|
auto first = tmp.begin();
|
auto last = tmp.end();
|
auto i = std::find_end(first, last, str.begin(), str.end());
|
return i != last ? static_cast<size_type>(std::distance(first, i)) : npos;
|
}
|
size_type string_view::rfind(value_type ch, size_type pos) const noexcept {
|
return rfind(string_view{&ch, 1}, pos);
|
}
|
size_type string_view::rfind(const_pointer str, size_type pos,
|
size_type n) const noexcept {
|
return rfind(string_view{str, n}, pos);
|
}
|
size_type string_view::rfind(const_pointer str, size_type pos) const noexcept {
|
return rfind(string_view{str, strlen(str)}, pos);
|
}
|
size_type string_view::find_first_of(string_view str,
|
size_type pos) const noexcept {
|
if (empty() || str.empty())
|
return npos;
|
if (pos >= size())
|
return npos;
|
if (str.size() == 1)
|
return find(str.front(), pos);
|
string_view tmp{data_ + pos, size_ - pos};
|
auto first = tmp.begin();
|
auto last = tmp.end();
|
auto i = std::find_first_of(first, last, str.begin(), str.end());
|
return i != last ? static_cast<size_type>(std::distance(first, i)) + pos
|
: npos;
|
}
|
size_type string_view::find_first_of(value_type ch,
|
size_type pos) const noexcept {
|
return find(ch, pos);
|
}
|
size_type string_view::find_first_of(const_pointer str, size_type pos,
|
size_type n) const noexcept {
|
return find_first_of(string_view{str, n}, pos);
|
}
|
size_type string_view::find_first_of(const_pointer str,
|
size_type pos) const noexcept {
|
return find_first_of(string_view{str, strlen(str)}, pos);
|
}
|
size_type string_view::find_last_of(string_view str,
|
size_type pos) const noexcept {
|
string_view tmp{data_, pos < size_ ? pos + 1 : size_};
|
auto result = tmp.find_first_of(str);
|
if (result == npos)
|
return npos;
|
for (;;) {
|
auto next = tmp.find_first_of(str, result + 1);
|
if (next == npos)
|
return result;
|
result = next;
|
}
|
}
|
size_type string_view::find_last_of(value_type ch,
|
size_type pos) const noexcept {
|
return rfind(ch, pos);
|
}
|
size_type string_view::find_last_of(const_pointer str, size_type pos,
|
size_type n) const noexcept {
|
return find_last_of(string_view{str, n}, pos);
|
}
|
size_type string_view::find_last_of(const_pointer str,
|
size_type pos) const noexcept {
|
return find_last_of(string_view{str, strlen(str)}, pos);
|
}
|
size_type string_view::find_first_not_of(string_view str,
|
size_type pos) const noexcept {
|
if (str.size() == 1)
|
return find_first_not_of(str.front(), pos);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.