Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi Fehler bei inttostr umwandlung (https://www.delphipraxis.net/30020-fehler-bei-inttostr-umwandlung.html)

ferby 18. Sep 2004 14:30


Fehler bei inttostr umwandlung
 
Hallo,

In meinen Programm komm vor:

Delphi-Quellcode:
freilevel:=1;
leveldat:='00';
leveldat[2]:=inttostr(freilevel);
wobei leveldat:string ist und freilevel:integer

Wenn diese Zeile ausgeführt wird kommt der Fehler:
[Fehler] Unit1.pas(358): Inkompatible Typen: 'Char' und 'String'


Das versteh ich nicht, ich verwende im ganzen Programm kein Char.

Kann mir wer weiterhelfen?

Dax 18. Sep 2004 14:31

Re: Fehler bei inttostr umwandlung
 
Du müsstest es in diesem Fall so machen:
Delphi-Quellcode:
freilevel:=1;
leveldat:='00';
leveldat[2]:=inttostr(freilevel)[1];

SirThornberry 18. Sep 2004 14:32

Re: Fehler bei inttostr umwandlung
 
"leveldat" ist bei dir zwar ein String aber
"leveldat[2]" ist ein Char denn du gibst ja an dass, das 2te Zeischen des Strings zu verwenden ist

ferby 18. Sep 2004 14:32

Re: Fehler bei inttostr umwandlung
 
Hallo,

Danke jetzt gehts.


Alle Zeitangaben in WEZ +1. Es ist jetzt 11:29 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