std::basic_string_view<CharT,Traits>:: find_last_not_of
From cppreference.net
<
cpp
|
string
|
basic string view
|
constexpr
size_type
find_last_not_of ( basic_string_view v, size_type pos = npos ) const noexcept ; |
(1) | (C++17 이후) |
|
constexpr
size_type
find_last_not_of ( CharT ch, size_type pos = npos ) const noexcept ; |
(2) | (C++17 이후) |
|
constexpr
size_type
find_last_not_of ( const CharT * s, size_type pos, size_type count ) const ; |
(3) | (C++17 이후) |
|
constexpr
size_type
find_last_not_of ( const CharT * s, size_type pos = npos ) const ; |
(4) | (C++17 이후) |
주어진 문자 시퀀스에 포함된 어떤 문자와도 일치하지 않는 마지막 문자를 찾습니다. 검색은
[
0
,
pos
]
구간만을 고려합니다.
1)
이 뷰에서 위치
pos
부터 시작하여,
v
의 문자들 중 어느 것과도 일치하지 않는 마지막 문자를 찾습니다.
2)
다음에 해당함
find_last_not_of
(
basic_string_view
(
std::
addressof
(
ch
)
,
1
)
, pos
)
.
3)
다음에 해당함:
find_last_not_of
(
basic_string_view
(
s, count
)
, pos
)
.
4)
다음에 해당함:
find_last_not_of
(
basic_string_view
(
s
)
, pos
)
.
목차 |
매개변수
| v | - | 검색할 뷰 |
| pos | - | 검색을 시작할 위치 |
| count | - | 비교할 문자열의 길이 |
| s | - | 비교할 문자열에 대한 포인터 |
| ch | - | 비교할 문자 |
반환값
주어진 문자열에 있는 어떤 문자와도 일치하지 않는 마지막 문자의 위치를 반환하며, npos 해당하는 문자가 없을 경우 이 값을 반환합니다.
복잡도
최악의 경우 O(
size()
* v.
size()
)입니다.
예제
이 코드 실행
#include <string_view> using std::operator""sv; int main() { static_assert(1 == "BCDEF"sv.find_last_not_of("DEF")); // ^ static_assert(2 == "BCDEFG"sv.find_last_not_of("EFG", 3)); // ^ static_assert(2 == "ABBA"sv.find_last_not_of('A')); // ^ static_assert(1 == "ABBA"sv.find_last_not_of('A', 1)); // ^ }
참고 항목
|
뷰에서 문자 찾기
(public member function) |
|
|
부분 문자열의 마지막 발생 위치 찾기
(public member function) |
|
|
문자의 첫 번째 발생 위치 찾기
(public member function) |
|
|
문자의 마지막 발생 위치 찾기
(public member function) |
|
|
문자가 처음으로 나타나지 않는 위치 찾기
(public member function) |
|
|
문자가 마지막으로 나타나지 않는 위치 찾기
(
std::basic_string<CharT,Traits,Allocator>
의
public member function)
|