C++ 문자열 substr()

Jmnote (토론 | 기여)님의 2023년 10월 31일 (화) 20:52 판
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

1 개요[ | ]

C++ substr()
C++ 부분문자열
#include <iostream>
using namespace std;
int main() {
	string str = "abcdefghijk";
	string sub1 = str.substr(4,2);
	cout << sub1 << endl; // ef
	string sub2 = str.substr(6); 
	cout << sub2 << endl; // ghijk
}

2 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}