[c++] 문자열에서 특정 문자열 삭제
#include <iostream>
#include <string>

int main() {
    std::string str = "Hello, world!";
    std::string to_delete = ", ";
    
    // 삭제할 문자열의 시작 위치를 찾습니다.
    size_t start_pos = str.find(to_delete);
    
    // 시작 위치부터 삭제할 문자열의 길이만큼의 문자를 삭제합니다.
    if (start_pos != std::string::npos) {
        str.erase(start_pos, to_delete.length());
    }

    std::cout << str << std::endl;  // "Hello world!"가 출력됩니다.
    return 0;
}

위의 예제 코드에서는 erase 메서드를 사용하여 to_delete 문자열 (“, “)을 삭제하고, 결과로 “Hello world!” 문자열이 출력됩니다. 필요에 맞게 위의 예제를 수정하여 사용하시면 됩니다.

더 복잡한 문자열 삭제 작업이 필요한 경우에는 정규 표현식 라이브러리인 std::regex를 사용하는 것이 더 적합할 수 있습니다.자세한 정보는 cppreference.com를 참조하세요.