help with path 
Author Message
 help with path

I need a way to convert the path "C:\test\hello world" into "C:\\test\\hello
world".
Is this possible in javascript?


Sat, 09 Oct 2004 10:49:13 GMT  
 help with path
Check out the 'replace' method of string objects.  I'd put the exact answer,
but since '\' is the escape character, you might have to fiddle a little
with using the right number of them in the regexp and the replacement
string...


Quote:
> I need a way to convert the path "C:\test\hello world" into
"C:\\test\\hello
> world".
> Is this possible in javascript?



Sat, 09 Oct 2004 11:15:36 GMT  
 help with path

Quote:
> I need a way to convert the path "C:\test\hello world" into "C:\\test\\hello
> world".

var sPath = "C:\\test\\hello world"
alert(sPath);
sPath = sPath.replace(/\\/g,"\\\\")
alert(sPath);

function alert(s){WScript.echo(s)}

--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US
--



Sun, 10 Oct 2004 03:08:27 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Converting logical paths to UNC paths

2. Long Path Names give Runtime error 76 - Path not found

3. Paths -- Creating File Path with several levels -- VBScript

4. Converting logical paths to UNC paths

5. Adding path to Path entry

6. Long Path Names give Runtime error 76 - Path not found

7. Adding path to Path entry

8. Converting local path to UNC path?

9. HELP!!! LOADPICTURE FILE PATH PROBLEM

10. Help: Paths print flattened (urgent)

11. Help, I'm getting Path/File Error

12. Path Issue - HELP!?!

 

 
Powered by phpBB® Forum Software