我需要在 rwcstring 中将所有出现的“\\”替换为“-”。
我曾尝试使用“RWCRExpr”来实现这一点,但没有任何效果。
请参考我在下面尝试过的组合并帮助我实现这一目标。
RWCString strchkk("");
RWCString strappendpath="D:\Newfolder\\new";
strchkk=strappendpath.replace(RWCRExpr("\\"), "-");
strchkk = strappendpath.replace(RWCRExpr("\\*"), "-*", RWCString::all);
strchkk = strappendpath.replace(RWCRExpr("\\?"), "-?", RWCString::all);
RWCString strappendpath1 = "D:\Newfolder\\new";
strchkk = strappendpath1.replace(RWCRExpr("\\*"), "-", RWCString::all);
strchkk = strappendpath1.replace(RWCRExpr("\\?"), "-", RWCString::all);
RWCString strappendpath2 = "D:\Newfolder\\new";
strchkk = strappendpath2.replace(RWCRExpr("\*"), "-", RWCString::all);
strchkk = strappendpath2.replace(RWCRExpr("\?"), "-", RWCString::all);
RWCString strappendpath3 = "D:\Newfolder\\new";
strchkk = strappendpath3.replace("\\", "-", RWCString::all);
strchkk = strappendpath3.replace("\\?", "-", RWCString::all);
strchkk = strappendpath3.replace("\\*", "-", RWCString::all);
RWCRExpr re("[A-Z][a-z]*\\");
strchkk = strappendpath.replace(re, "-");