How to replace all the "\\" occurance using rwcstring

167 views Asked by At

I need to replace all "\\" occurances as "-" in rwcstring.

I have tried using "RWCRExpr" to achieve this but nothing works.

Kindly refer the combinations i have tried below and assist me to achieve this.

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, "-");
0

There are 0 answers