« Best practices when macro substituting | Main | It is not too late... »
September 11, 2008
Character (string, text) delimiters
Here's my order of preference for character delimiters:
a) Apostrophe (') ... saves time since it is just one character and does not require you to press and hold down the <Shift> key ... easiest to read (least 'cluttered')
b) Square brackets ( [ and ] ) ... requires two (2) different characters but still does not require you to press and hold down the <Shift> key ... easy to read
c) Double quotes (") ... just one character but requires you to press and hold down the <Shift> key ... "busiest" in that it adds "white noise" to your code
I switch to square brackets if there's an apostrophe within the string. If the string contains (i) an apostrophe as well as (ii) one or both of the square brackets, then I employ double quotes.
Examples:
* My ideal is to employ apostrophes for delimiting character strings
WITH ThisForm
.icTableItemExpression = 'ALLTRIM(' + .icMainAlias + '.FPC_FacilityName)'
ENDWITH
* Here, I am forced to employ square brackets due to presence of embedded
* apostrophes
This.icDynamicFormCaption = ['Notes for '] + ;
[DTOC(C_AdmitDischarge.AD_AdmittedOn) + '-'] + ;
[DTOC(C_AdmitDischarge.AD_DischargedOn)]
* Here, I am forced to employ double quotes due to the presence of embedded
* square brackets as well as an embedded apostrophe
This.icDynamicFormCaption = "[Notes for McDonald's]"
* Alternatively, I could employ square brackets as the main character
* delimiter:
This.icDynamicFormCaption = ["Notes for McDonald's"]
(Regardless of what character delimiters you prefer to employ, I recommend that you be consistent!)
Posted by abergquist on September 11, 2008 | Permalink
TrackBack
TrackBack URL for this entry:
http://www.typepad.com/t/trackback/384091/33337696
Listed below are links to weblogs that reference Character (string, text) delimiters:




