String str = "/LLL/AAA\\FFF\\DDD\\GGG"
str.replace('\\','/');
所有\要写成\\

解决方案 »

  1.   

    public class Test 
    {
    public static void main(String[] args)
    {
    String s="/LLL/AAA\\FFF\\DDD\\GGG";
            System.out.println(s.replaceAll("\\","/"));
       }
    } //编译过去,运行出错晕
      

  2.   

    public class Test 
    {
    public static void main(String[] args)
    {
    String s="/LLL/AAA\\FFF\\DDD\\GGG";
            System.out.println(s.replace('\\','/'));
       }
    } //字符就ok,不知道何解,纳闷^_^
      

  3.   

    SQL语句:如下:SELECT REPLACE('/LLL/AAA\FFF\DDD\GGG','\','/')
      

  4.   

    import java.util.regex.*;
    public class replace {
        public static void main(String[] args) throws Exception {
            Pattern p = Pattern.compile("\\");
            Matcher m = p.matcher("/LLL/AAA\\FFF\\DDD\\GGG");
            StringBuffer sb = new StringBuffer();
            int i=0;
            boolean result = m.find();
            while(result) {
                i++;
                m.appendReplacement(sb, "/");
                result = m.find();
            }
            m.appendTail(sb);
            System.out.println("string="+ sb.toString());
        }
    }