Backslash problems - help! 
Author Message
 Backslash problems - help!

How can i convert a string like this:

"http:\\HTMDir\low\feed\new/biglink.html"

to this:

"http://HTMDir/low/feed/new/biglink.html"

I have an app where an url is typed in an input field and  saved in a
data base, but all the backslashes converts the url string because they
are interpreted as escape sequences...



Mon, 15 Apr 2002 03:00:00 GMT  
 Backslash problems - help!
Here is my own solution. This page is an input tag and a button that
displays the converted version of the string in the input tag:

<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>
<BODY>

<script language=javascript>

  function ReplaceBackSlashes(strInput, strReplacer)
  {
    var strOutput = strInput.replace(/\x5c/g, strReplacer);

    return strOutput;
  }

  function onShowURL()
  {
    alert( ReplaceBackSlashes(window.txtURL.value, "/") );
  }

</script>

<center>

<input id="txtURL" type="text"> <BR>
<BR>
<input type="button" onClick="javascript:onShowURL()"  value="Show Url" >

</center>

</BODY>
</HTML>



Mon, 15 Apr 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Stop backslash behaving as the escape character

2. Backslash disapears

3. getting to read the backslash

4. How to print backslash?

5. Reading registry values containing a backslash (\)

6. double backslashes

7. Slash/Backslash, Absolute/Relative Path in FSO

8. using Registry functions on valuenames with backslashes?

9. Using Backslash with RegWrite

10. Backslashes

11. Regread with Backslash

12. escaping backslashes

 

 
Powered by phpBB® Forum Software