In my android program I want to replace all backslash(\
) with slash(/
) in a string.
Replace All did not work for that.So please help me.
Asked
Active
Viewed 86 times
-3

ngrashia
- 9,869
- 5
- 43
- 58

user2603471
- 9
- 1
-
Post code and say exactly what's the problem. – Misagh Emamverdi Oct 01 '14 at 05:11
-
file\folder\a.png,this is the string but i want the string as file/folder/a.png. – user2603471 Oct 01 '14 at 05:15
-
You want to change in the code ? – Niko Adrianus Yuwono Oct 01 '14 at 05:15
-
possible duplicate of [String replace a Backslash](http://stackoverflow.com/questions/5596458/string-replace-a-backslash) – Mehul Joisar Oct 01 '14 at 05:18
3 Answers
0
Try below Code:
String origString = "file\\folder\\a.png";
String newString = origString.replaceAll("\\\\","/");
System.out.println (newString);
Output:
file/folder/a.png

ngrashia
- 9,869
- 5
- 43
- 58