I have a String that can assume two forms
First form
file:///mnt/sdcard/myfolder/myfile.txt
Second form
/file://mnt/sdcard/myfolder/myfile.txt
And I need the String always in the form
/mnt/sdcard/myfolder/myfile.txt
So I have used the replace command
myPath=path.replace("file://", "");
myPath= path.replace("/file:/", "");
But unfortunately doesn’t work
and String myPath results
file:///mnt/sdcard/myfolder/myfile.txt
What is wrong?
If you’re guaranteed that your string will always be in one of those two forms, why not just use
If you’re not sure your path contains “/mnt”, you could try this: