Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using quote inside strings in Delphi [duplicate]

Tags:

Possible Duplicate:
How does one escape characters in Delphi string

In Delphi a string is contained within a pair of ' but I need to use ' in my string... and when I use one it brings a end to the entire string identification.

'inside string ' but this bit is outside' inside again' and the end

Is there some symbol that removes the coding affect of the next character?

like image 222
Arthur Avatar asked Feb 25 '09 20:02

Arthur


People also ask

Can you have a string with a quote inside it?

To place quotation marks in a string in your code In Visual Basic, insert two quotation marks in a row as an embedded quotation mark. In Visual C# and Visual C++, insert the escape sequence \" as an embedded quotation mark.

How do you make a double quoted string?

If you need to use the double quote inside the string, you can use the backslash character. Notice how the backslash in the second line is used to escape the double quote characters. And the single quote can be used without a backslash.

How do I remove a quote from a string in Delphi?

If you just want to un-quote a string, you can do this: function UnQuote(Text: string): string; inline; begin if ( Text. StartsWith('"') or Text.

What is quoted string in Delphi?

Delphi has QuotedStr() function that adds quotes around string and does escaping of apostrophes in string automatically.


1 Answers

You need another quote to escape a quote:

Writeln('I''m in your head'); //prints: I'm in your head
Writeln(''''); //prints: '

See also this question.

like image 184
The_Fox Avatar answered Sep 30 '22 02:09

The_Fox