how to convert \ to / in strings using java

String path="C:\Documents and Settings\user\My Documents\Crypt.avi";

Eventhough path.replaceAll("\","/"); does'nt works!!!!!

can anyone tell me how to do this?

String s = "C:\\Documents and Settings\\user\\My Documents\\";
System.out.println("Before: " + s);
s = s.replace("\\", "/");
System.out.println("After: " + s);

Note the usage of replace, not replaceAll.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.