Autor Beitrag
bgeissl
Hält's aus hier
Beiträge: 7

WIN 2000
D6 Pers
BeitragVerfasst: Di 22.02.05 21:10 
Hallo,

die Funktion ExtractStrings erwartet im ersten Parameter den Datentyp Char. Den hab ich aber nicht. Ich kann nur mit String oder PChar dienen (beide auch nur ein Zeichen lang). Es gibt aber offensichtlich keine Funktion, mit der ich eine entsprechende Typumwandlung durchführen könnte. Ich habe die Hilfe jedenfalls stundenlang danach durchsucht. Was mach ich denn falsch???

ausblenden Delphi-Quelltext
1:
2:
3:
    chrbuff := pchar(copy(strLine,3,1));
    Seperator := chrbuff;
    nStrings:=ExtractStrings([Seperator], [' '], chrLine, strList);


Gruß
Boris
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Di 22.02.05 21:25 
Titel: Re: [Error] u.pas(380): Incompatible types: 'Char' and 'PCha
Hallo!

So wandelst du einen String in ein Char um:
ausblenden Delphi-Quelltext
1:
2:
Seperator := 'Ein langer String';
nStrings:=ExtractStrings(Sepertor[1], [' '], chrLine, strList);

Dieses Beispiel übergibt das "E" an die Funktion.

Gruß
Tino
tommie-lie
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 4373

Ubuntu 7.10 "Gutsy Gibbon"

BeitragVerfasst: Di 22.02.05 21:35 
Ein PChar ist ein Pointer auf ein Zeichen, wenn Separator vom Typ PChar ist, könntest du also auch mit Separator^ auf das erste Zeichen im String kommen.
Aber Tinos weg ist schon sinnvoller, wobei vielleicht angemerkt sei, daß nicht nur die 1 ein gültiger Index ist, das geht auch, wie bei dir, mit der 3 ;-)

_________________
Your computer is designed to become slower and more unreliable over time, so you have to upgrade. But if you'd like some false hope, I can tell you how to defragment your disk. - Dilbert
bgeissl Threadstarter
Hält's aus hier
Beiträge: 7

WIN 2000
D6 Pers
BeitragVerfasst: Di 22.02.05 21:36 
Titel: Jetzt: Incompatible types: 'TSysCharSet' and 'Char'
Danke,

funktioniert aber leider immer noch nicht. Jetzt kommt

Incompatible types: 'TSysCharSet' and 'Char'

Gemeint ist jetzt der 2. Parameter.

In der Hilfe steht:

Unit

SysUtils

type TSysCharSet = set of Char;

Was ist denn set of... ?


Zuletzt bearbeitet von bgeissl am Di 22.02.05 21:45, insgesamt 1-mal bearbeitet
tommie-lie
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 4373

Ubuntu 7.10 "Gutsy Gibbon"

BeitragVerfasst: Di 22.02.05 21:42 
Haste's mit ExtractStrings([Separator[1]], //... probiert?

_________________
Your computer is designed to become slower and more unreliable over time, so you have to upgrade. But if you'd like some false hope, I can tell you how to defragment your disk. - Dilbert
bgeissl Threadstarter
Hält's aus hier
Beiträge: 7

WIN 2000
D6 Pers
BeitragVerfasst: Di 22.02.05 21:47 
Sorry, war wohl doch der erste Parameter. Jetzt funktionierts! DANKE!
tommie-lie
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 4373

Ubuntu 7.10 "Gutsy Gibbon"

BeitragVerfasst: Di 22.02.05 21:51 
Titel: Re: Jetzt: Incompatible types: 'TSysCharSet' and 'Char'
bgeissl hat folgendes geschrieben:
Was ist denn set of... ?
Einmal set eintippen, Cursor draufsetzen und F1 drücken ;-)

_________________
Your computer is designed to become slower and more unreliable over time, so you have to upgrade. But if you'd like some false hope, I can tell you how to defragment your disk. - Dilbert