Forum Discussion

typoo1's avatar
typoo1
New Contributor
5 years ago
Solved

backslash being removed

Hi there;

 

I have a question: problem to show a backslash in my string  javascript script : 

 

var st="test\\TEST"; it gives me st=test\\TEST 

 

and  var st="test\TEST"; it gives me st=testTEST

 

but me i need st= test\TEST

 

thank you

  • Right... because it's giving you the value that is applied in the string pre-processing by the JavaScript engine.

    Since the log shows the backslash being removed in your earlier post, I assume that there's some sort of error you're getting when you're trying to connect.  Please post the error.

5 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    The first should work.  A double-backslash should return as a single slash... the backslash character is used for escaping certain characters in JavaScript strings.

     

    To verify, I created this little function.

    function testSlash(){
        var st;
        st = 'TEST\\TESTS';  // Logs as 'TEST\TESTS'
        Log.Message(st);
        st = 'TEST\TESTS';  //Logs as 'TESTTESTS'
        Log.Message(st);
    }

    So... my question for you... how are you using that string in your tests?  What are you doing witih it?  How are you consuming it?  A bit more code context as to how you are determinng what is being returned would be helpful.

    • typoo1's avatar
      typoo1
      New Contributor

      Hi;

       

      i tried this methode before it dosn't work, i need the backslash in connection string !!

       

      look at image attached.

       

      thank you

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        Based upon what I see in Image2... it's working just fine.  There is a backslash before the TEST (see attachment with highlighted section)

         

        What kind of error are you getting when you try the connection string?  Again, it looks like the backslash is properly applied.