Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

How to? escaping & in text

Oct
369
2
Hello

What is the best way to escape the & in the gosub call

gosub cpy “Celebrating the Songs & Voice of Pete Seeger.m4v”

I have “cpy” defined as

:cpy [file]

when I reference “file” %file the string splits at the & — tcc esc is set to ^ so ^& does not seem to work
 
Aren't the double quotes enough? I tried this little test.

Code:
v:\> type escapetest.btm
gosub xxx "a & b"
quit

:xxx [file]
echo %file

v:\> escapetest.btm
"a & b"
 
Oh, I see ... wrong kind of quotes. Either of these seems OK.

Code:
v:\> type escapetest.btm
gosub xxx "“Celebrating the Songs & Voice of Pete Seeger.m4v”"
gosub xxx "Celebrating the Songs & Voice of Pete Seeger.m4v"
quit

:xxx [file]
echo %file

v:\> escapetest.btm
"“Celebrating the Songs & Voice of Pete Seeger.m4v”"
"Celebrating the Songs & Voice of Pete Seeger.m4v"
 
Odd! Here it's split after "Celebrating".

Code:
v:\> type escapetest.btm
gosub xxx "“Celebrating the Songs & Voice of Pete Seeger.m4v”"
gosub xxx "Celebrating the Songs & Voice of Pete Seeger.m4v"
gosub xxx “Celebrating the Songs ^& Voice of Pete Seeger.m4v”
quit

:xxx [file]
echo %file

v:\> escapetest.btm
"“Celebrating the Songs & Voice of Pete Seeger.m4v”"
"Celebrating the Songs & Voice of Pete Seeger.m4v"
“Celebrating

v:\>
 
Only the regular ASCII quotes are meaningful to the parser. The fancy Unicode quotes do not affect parsing; they're just ordinary characters.
 
Back
Top