Topic: 求救!请问JAVA如何替换"\"字符啊??

  Print this page

1.求救!请问JAVA如何替换"\"字符啊?? Copy to clipboard
Posted by: yufsih123
Posted on: 2006-01-06 11:57

要将字符串的"\"替成"\\",直接用正则表达式可以吗?谢谢

2.Re:求救!请问JAVA如何替换"\"字符啊?? [Re: yufsih123] Copy to clipboard
Posted by: blueoxygen
Posted on: 2006-01-06 15:52


String strTest = "aaa/";
System.out.println(strTest);
strTest = strTest.replaceAll("/","//");
System.out.println(strTest);

reg is not required.

3.Re:求救!请问JAVA如何替换"\"字符啊?? [Re: blueoxygen] Copy to clipboard
Posted by: zcjl
Posted on: 2006-01-06 20:08

replaceAll("\\\\", "\\\\\\\\");


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923