Re: using a quote ' in Delphi string

Posted by webmaster Guido:

In Reply to: using a quote ' in a Delphi string posted by alex:

: 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)