我的问题类似如下:
   String  aPath="c:\down/2005";   aPath=aPath.replace("\\","/");

解决方案 »

  1.   

    这样有问题么? 
    好像应该是
    String  aPath="c:\down/2005";   aPath=aPath.replace("\\\\","/");
      

  2.   

    String  aPath="c:\\down/2005";aPath=aPath.replace('\\','/');

    aPath=aPath.replaceAll("\\\\","/");
      

  3.   

    aPath=aPath.replaceAll("\\\\","/").replaceAll("//","/");
    //准行
      

  4.   


    public class text {
      public text() {
      }
      public static void main(String []args)
     { String  aPath="c:/down/2005";
     System.out.println(aPath);
     aPath=aPath.replace('/','\\');
    System.out.println(aPath);
      }
      

  5.   

    import java.util.*;
    public class CountLitterInArray{
    public static void main(String [] args){
      String a="C:\\dd/a.txt";
      System.out.println(a.replace('\\','/'));
    }
    }  这样可以吧a转成 C:/dd/a.txt\ 符合特殊的,是转义符