C++ 문자열 2개로 분할

1 개요[ | ]

C++ 문자열 2개로 분할
#include <iostream>
#include <cstring>
using namespace std;

int main() {
    string s = "Hello World";
    int pos = s.find(" ");
    string a = s.substr(0, pos);
    string b = s.substr(pos+1);
    cout << '[' << a << ']' << endl; // [Hello]
    cout << '[' << b << ']' << endl; // [World]
}

2 같이 보기[ | ]

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