Autor Beitrag
Asgar
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 160

XP Home Edition
D5
BeitragVerfasst: Di 07.06.05 12:10 
Hallo, ich will in einem string das Zeichen ' finden, normalerweise finde ich die Position davon mit dem POS befehl heraus, aber bei diesem zeichen get das ja nicht da man normalerweise den zu suchenden string zwischen zwei ' setzt. Wie kann ich jetzt nach diesem symbol suchen? kann man irgendwie verhindern das das zeichen als anfang eines strings gewertet wird?
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Di 07.06.05 12:13 
ausblenden Delphi-Quelltext
1:
if pos (#39,s) > 0 then bla;					

_________________
es gibt leute, die sind genetisch nicht zum programmieren geschaffen.
in der regel haben diese leute die regel...
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Di 07.06.05 12:15 
Jip.

Einfach Doppelt angeben:

ausblenden Delphi-Quelltext
1:
2:
3:
Leerstring := '';
Hochkomma := '''';
HochkommaAmAnfangUndEndeEinesStrings := '''Hallo Welt''';


UC?

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
alzaimar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: Di 07.06.05 12:18 
Um ein einfaches Anführungszeichen in einem String darzustellen, muss es 2x hinereinander geschrieben werden, was ganz schön lustig aussieht:
ausblenden Delphi-Quelltext
1:
ShowMessage('Ein Quote '', und hier sind zwei ''''');					

Aber die #39 vom retnyg lassen wir auch mal gelten. Sind ja nich so.
Asgar Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 160

XP Home Edition
D5
BeitragVerfasst: Di 07.06.05 12:19 
ok, danke es funktioniert.
Gibts irgendwo ne Tabelle für diese ganze #Symbole?
alzaimar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: Di 07.06.05 12:27 
Bau Dir eine:
For i:=32 to 255 do memo1.lines.add(Format ('#%s = %s',[i,chr(i)+'']));