Notice
Recent Posts
Recent Comments
Link
«   2025/02   »
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
Tags
more
Archives
Today
Total
관리 메뉴

main

[C ++] 문자열 공백 제거 본문

C | C++

[C ++] 문자열 공백 제거

1984 2022. 1. 30. 23:13

 

코드
#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
Comments