This version is out of date, covering development from v8.0.0 to v8.x.x. It is maintained here only for inbound reference links from elsewhere. It is no longer actively updated.

Jump to the current version of aTbRef

Tinderbox v8 Icon

Quoting and escaping strings in Tinderbox coding

From version 4 onwards Tinderbox has moved towards a convention of using double quotes to enclose string literals (i.e. text) when used in Tinderbox codes. An example for ambiguity is where we wish to clarify that we mean 'yesterday' as the word yesterday as opposed to the Tinderbox date placeholder 'yesterday' that is used to subtract one day in doing date calculations. In such a scenario with want to ensure the first instance is quoted and the later is not, thus:

$DisplayExpression = "Yesterday is: " + date(yesterday) 

In many contexts the app will still guess—usually correctly—if quotes are not used. The reason for the change in convention is the increase in the scope of coding that Tinderbox offers and with it the scope for unintended consequences if the app must figure out what is text and what is not. As a plus sign may be either a potential string concatenator (joiner) or an addition sign and a dash be a minus sign or hyphen, then quoting strings also helps when the app must coerce numbers to strings and vice versa.

Although the advised norm for enclosing string literals is to use double quotes, Tinderbox can handle balanced single or double quotes as text string delimiters. This can be helpful when trying to handle strings that must use double quotes, e.g. the quotes surrounding HTML attributes:

$MyString = '<div width="' + $ItemWidth + '">'; 



A Tinderbox Reference File : Objects & Concepts : Coding conventions : Quoting and escaping strings in Tinderbox coding