Re: using a quote ' in Delphi string


[ DelphiLand FAQ ]

Posted by webmaster Guido on July 29, 2004 at 12:12:18:

In Reply to: using a quote ' in a Delphi string posted by alex on July 28, 2004 at 23:40:11:

: I have a problem. One of my folders is named c:\windows\desktop\nana's folder. When I do any kind of thing to this there is a problem because nana's causes the problem. How do I do this
: DeleteFile ('C:\windows\desktop\nana's folder');

: The problem is when it gets to nana' it things the line of code is over. How do you get around this without renaming everything.
-----------------

In Object Pascal, Delphi's language, literal strings are delimited with single quotes, like this:
S := 'Delphi';

If you want to include a single quote in a string, type it as TWO single quotes, like this:

S := 'Delphi''s language';

Attention: use '' (single quote ' followed by single quote ') but not " (double quote)


[ DelphiLand FAQ ]