Log in

View Full Version : did you know: string containing quotes


WarpEnterprises
25th February 2004, 22:48
Up today I didn't knew a way to type a string containing quotes.
Well, you can use chr(34), but that's not really short.

I always wondered about the following sentence in the original docu from BenRG:

A text string is surrounded either by "quotation marks" or by ``TeX-style quotes''. A text string can contain any character except the terminating quotation mark or double-apostrophe. If you need to put a quotation mark inside a string, use the TeX-style notation.

Well, I never figured out what he meant with TeX-style, because no combination of ' or ` or " worked. So today I looked in the source code - and the solution (which was there since the first day) is THAT SIMPLE:

e.g.

Subtitle(""" now you can put as many " in here as you like""")

TeX-Style = Use three quotes at the beginning and the end and you can put in the string single quotes.

mf
25th February 2004, 23:33
Then why the hell did he say:
``TeX-style quotes''
Cause that's definitely different from three quotes.

stickboy
26th February 2004, 03:52
Cool!

AFAIK, TeX does not use the (Python-style?) triple-quote system. As implied by the documentation, TeX uses two backticks (``) followed by two apostrophes (''), but that functionality appears to be broken in AviSynth.

I can't say I miss it, and I think it's better as it currently is. TeX-style quotes aren't common outside of TeX, and I prefer canonical syntax over having multiple ways of representing string literals.

WarpEnterprises
26th February 2004, 16:29
Now I found why it's in the old doc: because that was the way it worked in AviSynth 0.3 - and in 1.03 it was changed to the new way.

mf
28th February 2004, 21:22
Updated the wiki (http://www.avisynth.org/index.php?page=ScriptVariables) :). If anyone finds my wording too bad feel free to change it ;).

bill_baroud
28th February 2004, 22:03
just a thought .... "a string with \"quotes\"" doesn't work ?

i always do something like this when needed (not in avisynth though, more in C, java or unix shell)

mf
28th February 2004, 22:06
Nope. Escaping was also the first thing I tried, but the \ sign is already taken for line wrapping.

bill_baroud
28th February 2004, 22:13
ah ok, thanks :)

stickboy
28th February 2004, 22:22
I don't think the fact that \ is the line continuation character should be problem. It's only a line continuation character outside of a string. (After all, it's also the line continuation character in C!)

I think the bigger issue is that using it as an escape character will break existing scripts that use it in paths. For example:
AVISource("C:\bar\foo.avi") # \b shouldn't be a backspace

frequentPath = "C:\bar\" # we don't want the quote to be escaped
Import(frequentPath + "baz.avs")

Comatose
9th December 2007, 23:37
Simple: C:/bar/

edit: Er, uh, sorry... didn't notice this thread was from '04.

Spuds
10th December 2007, 04:29
Simple: C:/bar/

edit: Er, uh, sorry... didn't notice this thread was from '04.

Humm first post .. perhaps f:/ubar/ would have been more appropriate... :D

stickboy
11th December 2007, 11:26
Simple: C:/bar/

edit: Er, uh, sorry... didn't notice this thread was from '04.You totally missed the point anyway, which is not to break already-existing scripts.

If you ignore that requirement, sure, you can do whatever the hell you want.