C++利用正则表达式进行字符串的替换

主要要加上头文件#inlcude,这也是剑指offer上的题目

void replaceSpace(string str,int length) {
        
        string pattern=" ";
        regex re(pattern);
        string fmt="20%";
        string ret=regex_replace(str,re,fmt);
        cout<<ret<<endl;

	}

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/u010589524/article/details/82831842
今日推荐