Hello Vim List,

I appear to be a little confused about strings "\\" vs
"\\\\" and literals '\' vs '\\'.

Here's an example.

    let a = 'a\b'
    echo a

This displays "a\b" (without the double quotes).

    let a = "a\\b"
    echo a

This displays the same thing as expected.

Also note that:

    echo '\\'
    echo "\\\\"

both display "\\" (without the double quotes) as expected.

But now look at these four:

    echo substitute(a,'\','/','')
    echo substitute(a,'\\','/','')
    echo substitute(a,"\\",'/','')
    echo substitute(a,"\\\\",'/','')

I expected the first and third to display "a/b" (without the
double quotes) and the second and fourth to display the
original value of the variable `a`.

They all make the substitution, even though the second and
fourth do not appear to match the variable.

Why?

-- 
Best regards,
Bill

Reply via email to