Page 1 of 1

How to create a string with a single backslash?

Posted: Tue Sep 15, 2009 9:48 am
by ale870
Hello,

I found a problem: I need to create a string with "\".

See here:

Code: Select all

> (setq a (string "1" {\} "2"))
"1\\2"
Well, I tried in many ways, but I get an error, or I get a string with a double "\\" instead a single "\". I need it to create a Windows network path:

\\myserver\shared_dir\myfile.txt

It seems incredible, but I cannot find a way, in windows (but I even made some tests in Liunux and the results are similar) to compose that string.

Please can you help me?

Thank you!

Posted: Tue Sep 15, 2009 9:59 am
by ale870
UPDATE: Sorry, I'm eating my brain! I made a mistake.

See here:

Code: Select all

> (setq a (string "1\\2"))
"1\\2"
> (length a)
3
The final string is correct: 3 characters long.

Topic closed because I'm stupid :-)