C++ 文字列を英数字のみにする(use STL)

#include <algorithm>
#include <string>

std::string str = "example string with 1234567890";
str.erase(std::remove_if(str.begin(), str.end(), [](unsigned char c){ return !std::isalnum(c); }), str.end());

ChartGPTで教えてもらってテスト済。

ChartGPTはしれっと嘘つくから確認必須。