这是我的代码
// replace all new lines with string "nl"
std::string s = "Stack\nover\rflowâ€";
boost::regex expr1("(\\n)|(\\r)");
std::string fmt("nl");
std::string s2 = boost::regex_replace(s, expr, fmt);
Run Code Online (Sandbox Code Playgroud)
然后用空字符串替换所有非ascii字符
boost::regex expr2("([^\x20-\x7E])")
std::string fmt2("");
std::cout << boost::regex_replace(s2, expr2, fmt2) << std::endl;
Run Code Online (Sandbox Code Playgroud)
我宁愿打一个电话来代替两个.
我有一个2D数组(int的向量向量)与int值,如这些
34 19 89 45 21 34 67 32 87 12 23 18
我想找到列值(不是行值)的最大值和最小值,最好使用STL算法
std::max_element, std::min_element
Run Code Online (Sandbox Code Playgroud)