- - * - WhiteUnicorn - * - -




* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >


Frequently Asked Questions

Embedding a quite in a string.

Question:

How can I embed a quote in a string since it is a reserved delimiter?

Answer:

You can either use two single quote characters where a 

single quote is required, or define a constant who's value 

is character number 39. If you have many quotes to embed 

(this can happen in a complex  SQL statement), the second 

method is preferred.



Example:



const Quote = #39;



{This line will not compile!}

ShowMessage('The smith's yard is greener than ours');



{This line will compile}

ShowMessage('The smith''s yard is greener than ours');



{This line will compile}

ShowMessage('The smith' + Quote + 's yard is greener than ours');




* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >



- - * - Anastasija aka WhiteUnicorn - * - - LJLiveJournal
PFPhotoFile