[c++] C++에서의 문자열에서 알파벳 이외의 문자 제거하는 방법
#include <iostream>
#include <string>
#include <algorithm>

int main() {
    std::string str = "Hello123World!";

    str.erase(std::remove_if(str.begin(), str.end(), [](char c) {
        return !std::isalpha(c);
    }), str.end());

    std::cout << str << std::endl;

    return 0;
}

이 코드는 “std::isalpha” 함수를 사용하여 문자열에서 알파벳이 아닌 모든 문자를 제거합니다. 위 코드를 실행하면 “HelloWorld”가 출력됩니다.