std:: strspn
From cppreference.net
C++
Text processing library
| Localization library | |||||||||||||||||||||||||
| Regular expressions library (C++11) | |||||||||||||||||||||||||
| Formatting library (C++20) | |||||||||||||||||||||||||
| Null-terminated sequence utilities | |||||||||||||||||||||||||
| Byte strings | |||||||||||||||||||||||||
| Multibyte strings | |||||||||||||||||||||||||
| Wide strings | |||||||||||||||||||||||||
| Primitive numeric conversions | |||||||||||||||||||||||||
|
|||||||||||||||||||||||||
| Text encoding identifications | |||||||||||||||||||||||||
|
|||||||||||||||||||||||||
Null-terminated byte strings
| Functions | ||||||||||||||||||||||||||||||||||||
| Character classification | ||||||||||||||||||||||||||||||||||||
| Character manipulation | ||||||||||||||||||||||||||||||||||||
| Conversions to numeric formats | ||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||
| String manipulation | ||||||||||||||||||||||||||||||||||||
| String examination | ||||||||||||||||||||||||||||||||||||
| Character array functions | ||||||||||||||||||||||||||||||||||||
| Miscellaneous | ||||||||||||||||||||||||||||||||||||
|
헤더 파일에 정의됨
<cstring>
|
||
|
size_t strspn
(
const
char
*
dest,
const
char
*
src
)
;
|
||
dest 가 가리키는 바이트 문자열의 최초 세그먼트(span) 중 src 가 가리키는 바이트 문자열에 포함된 문자로만 구성된 최대 구간의 길이를 반환합니다.
목차 |
매개변수
| dest | - | 분석될 null로 종료되는 바이트 문자열에 대한 포인터 |
| src | - | 검색할 문자들을 포함하는 null로 종료되는 바이트 문자열에 대한 포인터 |
반환값
src 가 가리키는 바이트 문자열에 포함된 문자들로만 구성된 최대 초기 세그먼트의 길이입니다.
예제
이 코드 실행
#include <cstring> #include <iostream> #include <string> const char* low_alpha = "qwertyuiopasdfghjklzxcvbnm"; int main() { std::string s = "abcde312$#@"; std::size_t spnsz = std::strspn(s.c_str(), low_alpha); std::cout << "After skipping initial lowercase letters from '" << s << "'\nThe remainder is '" << s.substr(spnsz) << "'\n"; }
출력:
After skipping initial lowercase letters from 'abcde312$#@' The remainder is '312$#@'
참고 항목
|
다른 바이트 문자열에서 찾을 수 없는 문자들로만 구성된
최대 초기 세그먼트의 길이를 반환합니다 (함수) |
|
|
다른 와이드 문자열에서 발견되는 와이드 문자들로만 구성된
최대 초기 세그먼트의 길이를 반환합니다 (함수) |
|
|
구분자 집합에서 임의의 문자가 처음 나타나는 위치를 찾습니다
(함수) |
|
|
C documentation
for
strspn
|
|