How to create a string with a single backslash?

Machine-specific discussion
Unix, Linux, OS X, OS/2, Windows, ..?
Locked
ale870
Posts: 297
Joined: Mon Nov 26, 2007 8:01 pm
Location: Italy

How to create a string with a single backslash?

Post 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!
--

ale870
Posts: 297
Joined: Mon Nov 26, 2007 8:01 pm
Location: Italy

Post 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 :-)
--

Locked