main
[C ++] 문자열 공백 제거 본문
코드
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(void)
{
string str = "str ing";
str.erase(remove(str.begin(), str.end(), ' '), str.end());
cout << str;
return 0;
}
결과값
string
728x90
'C | C++' 카테고리의 다른 글
[C++] 문자열 소문자-대문자 변환 (0) | 2022.01.30 |
---|---|
[C++] warning C4804: '>': unsafe use of type 'bool' in operation (0) | 2022.01.30 |
Comments