0

I have the URL like \abcfolder\cdf\ghi now i need to convert the URL like //abcfolder/cdf/TCSPMs/ghi .I used the following code but its not working . Need your suggestions.

string url = "\\abcfolder\cdf\ghi";
url.replace("\\" , "//")
url.replace("\" , "/")

How can I achieve this ?

User
  • 1,644
  • 10
  • 40
  • 64
  • For the clear reference i added the url like that .But actualy i get the value from service – User Nov 24 '16 at 13:35

1 Answers1

-1

first, javascript doesn't use the "string" variable declaration, just use var yourVarName = "this is a string"

second, your string should escape backslashes to work properly.

below i have put an example of how to replace the backslashes with forward slashes:

var url = "\\abcfolder\\cdf\\ghi";
alert(url.replace(/\\/g,"/"));
Kevin Kloet
  • 1,086
  • 1
  • 11
  • 21