cancel
Showing results for 
Search instead for 
Did you mean: 

backslash being removed

SOLVED
New Contributor

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

1 ACCEPTED SOLUTION

Accepted Solutions
Community Hero

Re: backslash being removed

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.


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
5 REPLIES 5
Community Hero

Re: backslash being removed

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.


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
New Contributor

Re: backslash being removed

Hi;

 

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

 

look at image attached.

 

thank you

Community Hero

Re: backslash being removed

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.

 

 


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
New Contributor

Re: backslash being removed

Thank you for your answer !! 

 

Loook when evalue the value of connection String in the joinned image !! le problem is there .

Community Hero

Re: backslash being removed

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.


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
New Here?
Join us and watch the welcome video:
API Testing Mistake #2
APITestingMistake#2
Top Kudoed Authors