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

How can i convert a string like this:


to this:


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:

<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">

<script language=javascript>

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

    return strOutput;

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



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



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