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?
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.
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.
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.
Delphi has QuotedStr() function that adds quotes around string and does escaping of apostrophes in string automatically.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With