String replace a Backslash

前端 未结 8 923
死守一世寂寞
死守一世寂寞 2020-11-27 06:50

How can I do a string replace of a back slash.

Input Source String:

sSource = \"http://www.example.com\\/value\";

8条回答
  •  星月不相逢
    2020-11-27 07:16

    you have to do

    sSource.replaceAll("\\\\/", "/");
    

    because the backshlash should be escaped twice one for string in source one in regular expression

提交回复
热议问题