cancel
Showing results for 
Search instead for 
Did you mean: 

backslash being removed

SOLVED
Highlighted
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
Highlighted
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
[Hall of Fame]
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
Vegas Thrill Rider
Extensions available

View solution in original post

5 REPLIES 5
Highlighted
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
[Hall of Fame]
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
Vegas Thrill Rider
Extensions available
Highlighted
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

Highlighted
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
[Hall of Fame]
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
Vegas Thrill Rider
Extensions available
Highlighted
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 .

Highlighted
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
[Hall of Fame]
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
Vegas Thrill Rider
Extensions available

View solution in original post

New Here?
Join us and watch the welcome video:
Announcements
Join TechCorner Challenge!
Want a fun and easy way to learn TestComplete? Try solving weekly TechCorner challenges and get into the Leaderboard!


Challenge Status

Compare images using the Region Checkpoint

See replies!

Converting UTC TimeDate in an Excel file

See replies!

Compare HTML table with Excel file and correct data in Excel file

Participate!

How to execute remote test and obtain results via Test Runner REST API

Participate!
Top Kudoed Authors