![]() |
Re: Umwandlung TStrings in Integer
Ohne Code kann ich das absolut nicht kommentieren.
|
Re: Umwandlung TStrings in Integer
auf seite eins steht der gesamte quelle code... und versuch 2 das mit dem integerarray...
|
Re: Umwandlung TStrings in Integer
Dein zweiter Versuch sollte so vom Syntax her korrekt sein:
Delphi-Quellcode:
Wie ist denn Dein IntegerArray definiert?
for j := 0 to F.Count - 1 do
begin integerarray[j]:= StrToInt(F.Strings[j]); end; String in Zahlenwert umwandeln -> StrToInt (wandelt String in Integer um) -> StrToFloat (wandelt String in ein Floatwert um) So schwer ist das doch nicht. Grüße Klaus |
Re: Umwandlung TStrings in Integer
Ich vermute mal ganz stark, dass integerarray nicht deklariert wurde.
Delphi-Quellcode:
var
integerarray: array of integer; begin SetLength(integerarray, F.ItemsCount); {..} for j := 0 to F.itemsCount - 1 do begin integerarray[j]:= StrToInt(F.Items[j]); end; {..} end; |
Re: Umwandlung TStrings in Integer
Hi
Ehm das Problem liegt ganz woanders.. du musst und darfst die Strings in deiner Liste gar nicht in Zahlen umwandeln! So muss das heißen:
Delphi-Quellcode:
Gruß
for j := 0 to F.itemsCount - 1 do
begin rows[j]:= SF.Items[j]; end; Neutral General |
Re: Umwandlung TStrings in Integer
@Neutral General: Was ist SF?
Items funktioniert nicht... ich habe die beiden Quelltexte (Neutral General,Dunkel) ausprobiert und jedesmal hat er ein Problem mit items... er sagt dazu "Undeclared identifier:'items'". Kann es daran liegen,dass ich Delphi 7 Personal benutze? |
Re: Umwandlung TStrings in Integer
Denk doch mal mit!
In einer TList heißt das nun mal Items. Bei TStrings muss es Strings heißen. |
Re: Umwandlung TStrings in Integer
Also, bei mir geht das hier:
Delphi-Quellcode:
procedure TForm1.FormCreate(Sender: TObject);
var F: TStringList; integerarray: array of integer; i: integer; begin F := TStringList.Create; try F.Add('1'); F.Add('2'); F.Add('3'); F.Add('4'); F.Add('5'); F.Add('6'); F.Add('7'); F.Add('8'); F.Add('9'); F.Add('10'); SetLength(integerarray,F.Count); for i := 0 to F.Count - 1 do integerarray[i] := StrToInt(F[i]); for i := 0 to Length(integerarray) - 1 do ShowMessage(Format('%d hat den Wert %d',[i,integerarray[i]])); finally FreeAndNil(F); end; end; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 14:54 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz