Главная страница | назад





Article #17498: Embedding a quite in a string.

 Question and Answer Database
FAQ2498D.txt Embedding a quite in a string.
Category :Object Pascal
Platform :All
Product :All 32 bit
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');
7/16/98 4:31:28 PM

Last Modified: 01-SEP-99