Back HomeBack to DocumentsBack to D-I-E-S-E-LYou are here
The quote-quote-quote

This page is outdated and no longer part of our regular homepage.
It has been kept alive just in case external links still point to it. It will be removed soon.
Please visit instead our main page at

The quote-quote-quote

VG-Wort Access-ZählmarkeUnfortunately DIESEL has a lot of problems as soon as you create complicated macros. DIESEL uses a limited string space and you can easily crash AutoCAD by exceeding this limit.

Also the handling of quotes is not easy to understand, if ever. From the main text you know that


returns 12, and


returns 5. But would you imagine that


also returns 12?

Even more strange is that quotes get lost during the DIESEL evaluation. What do you expext this expression to return?


I would expect it to return 1, but certainly not 5! If you look at the macro trace, you see what happens:

Eval: $(SUBSTR, $(strlen,Hello,world!), 1, 1)

Eval: $(STRLEN, Hello, world!)

===> 5

===> 5

As soon as the string is passed to the substr DIESEL function, the quotes are lost. Therefore the strlen funktion consequently returns 5. To pass the quotes through the substr function to the nested strlen function, you need to add some more quotes:


Eval: $(SUBSTR, $(strlen,"Hello,world!"), 1, 1)

Eval: $(STRLEN, Hello,world!)

===> 12

===> 1

Every level of nesting reduces the number of quotes. Therefore you need to know in advance how many levels down you still need quotes. Suppose you want to add 1 to the result above. Now the correct DIESEL expression is:


Eval: $(+, 1, $(substr,$(strlen,"""Hello,world!"""),1,1))

Eval: $(SUBSTR, $(strlen,"Hello,world!"), 1, 1)

Eval: $(STRLEN, Hello,world!)

===> 12

===> 1

===> 2

This is a shareware document. What is a shareware document? Did this article help you earn some money? Then give something back! Help creating shareware documents by donating something to the author:

Contact CR/LF GmbH

© 2000-2011 by CR/LF GmbH, Essen/Germany. All rights reserved.
No part of this document may be reproduced or published without written consent by CR/LF GmbH.
Last modification: 01.04.2011