Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi Apostroph im String escapen? (https://www.delphipraxis.net/98752-apostroph-im-string-escapen.html)

ReBoot 31. Aug 2007 18:51


Apostroph im String escapen?
 
Ich müsste 'n Apostroph innen String schreiben. Delphi nimmt allerdings das Apostroph als Ende vom String an (was wir ja alle kennen).
Frage: wie escape ich das Apostroph, sodass es mir am Ende im String landet?

mkinzler 31. Aug 2007 18:53

Re: Apostroph im String escapen?
 
QuotedStr()

Phoenix 31. Aug 2007 18:55

Re: Apostroph im String escapen?
 
Einfach verdoppeln.

sirius 31. Aug 2007 18:56

Re: Apostroph im String escapen?
 
Delphi-Quellcode:
s:='Hier sind zwei ''Apostrophe'' im String';

angos 31. Aug 2007 18:57

Re: Apostroph im String escapen?
 
Delphi-Quellcode:
CHR($27)

oder so wie meine verposter schrieben ;)
Gruß

ReBoot 31. Aug 2007 18:59

Re: Apostroph im String escapen?
 
Das CHR bringt's, danke!

Phoenix 31. Aug 2007 19:00

Re: Apostroph im String escapen?
 
:gruebel:

Also: 'Das is''n Text' --> Das is'n Text.
Definitiv, da wird nix von halb zu ganz gemacht, was auch immer damit gemeint ist.

Andreas H. 31. Aug 2007 22:44

Re: Apostroph im String escapen?
 
Noch ne Variante:
Delphi-Quellcode:
'Das is'#39'n Text'


Alle Zeitangaben in WEZ +1. Es ist jetzt 07:07 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz