Tags
- postman
- postman session
- UI/UX Engineer
- emplace_back
- solidity
- postman pre-request
- postman automations
- Android
- C++
- 프런트엔드
- Java
- postman csv
- PL/SQL
- oracle
- LSL_Script
- web developer
- Front-end developer
- postman tests
- Unity
- postman collection
- postman html parse
- Android/iOS Developer
- 좋은 개발자
- postman excel
- c#
- Interaction developer
- MFC
- 우수한 프런트 개발자
- Intellij
- postman collection variables
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Archives
- Today
- Total
david's daily developer note
[C++] 부분 문자열 검색 본문
728x90
다음은 문자열 (std::string)에서 부분 문자열을 검색하는 예제이다.
find
find는 대상 문자열의 0번 인덱스로부터 입력된 문자열의 시작 인덱스를 반환한다.
std::string full = "AbcAbc";
std::string sub = "bc";
std::cout << full.find(sub) << std::endl;
rfind
rfind는 대상 문자열의 마지막 문자부터 입력된 문자열의 시작 인덱스를 반환한다.
std::string full = "AbcAbc";
std::string sub = "bc";
std::cout << full.rfind(sub) << std::endl;
find, rfind 함수에서 찾는 문자열이 없다면 std::string::npos (쓰레기값)를 반환한다.
std::string full = "AbcAbc";
std::string sub = "df";
std::cout << " Result : " << full.find(sub) << std::endl;
728x90