Topic: About apostrophe

Hello Dmitry and to All

In french language, some words use an apostrophe (example, to say Today, in french we use the word aujourd'hui).
In this french word, there is an apostrophe.

But in Delphi language (Pascal), apostrophe is a reserved word.
It is used to delimitate a string.

As a result; en error raises.
Solution is to double quote for the word in question.
To avoid this constraint, I thought of using the function QuotedStr as :

procedure Form1.Edit1_OnChange;
var str : string;
begin
  str = QuotedStr(Form1.Edit1);
end;

It seems I can't used function QuoedStr with MVD.

In the meantime, I correct this problem by entering two quotes (and not a double quote - ASCII characters are different) in the incriminated word then I correct this word generating an error by only putting a quote.

As if the first entry had systematically placed the two quotes delimiting the string.

Any explication about this problem ?

Thanks all and goof Christmas !

JB

Re: About apostrophe

Hello.


Your purpose to use this text in SQL queries? Just use sqlValue instead Text
Example:

SQLExecute('INSERT INTO tablename (textfield) VALUES('+Form1.Edit1.sqlValue+')');


Property sqlValue return quoted string to use it in SQL queries.

Dmitry.

Re: About apostrophe

Hello Dmitry,

Interesting answer when using SQL queries.

And in the case of an entry made in EditBox?
Currently, I solve the problem by doubling the quote.

Thanks again

JB