C++ 간편한 string split
C++은 아직까지 다른 언어들처럼(ex. Python의 split) 간결하고 우아한 string split 함수를 제공하지는 않습니다.split을 구현하는 데에는 여러가지 방법이 있지만, 저는 std::getline을 사용하는 방법이 가장 깔끔하다고 생각합니다. 코드는 아래와 같습니다. 12345std::stringstream ss(stringData);while (std::getline(ss, stringData, ',')){ // 이제 stringData가 ,를 구분자로 사용하여 나뉘어집니다.}Colored by Color Scriptercs
insoooo
2018. 8. 2. 11:33
개발/C++
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday