Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi String->Smallint (https://www.delphipraxis.net/34991-string-smallint.html)

LoL 1. Dez 2004 08:54


String->Smallint
 
moin,

kann man einen String direkt in SmallInt convertieren?
(StrToSmallint? :gruebel: )

Sharky 1. Dez 2004 08:56

Re: String->Smallint
 
Hai,

das sollte doch auch mit Delphi-Referenz durchsuchenStrToInt gehen.

LoL 1. Dez 2004 08:58

Re: String->Smallint
 
mein probelm ist ich will von Int was von Typ smallint abziehen und das geht nit

Luckie 1. Dez 2004 09:01

Re: String->Smallint
 
Zitat:

Zitat von LoL
mein probelm ist ich will von Int was von Typ smallint abziehen und das geht nit

Geht:
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
  i: Integer;
  si: Smallint;
begin
  i := 1259;
  si := 10;
  ShowMessage(IntToStr(i-si));
end;

Sprint 1. Dez 2004 09:02

Re: String->Smallint
 
Zitat:

Zitat von LoL
mein probelm ist ich will von Int was von Typ smallint abziehen und das geht nit

Warum sollte das nicht gehen?

Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
  LI: Integer;
  SI: Smallint;
begin

  LI := 6;
  SI := 12;

  SI := SI - LI;

  ShowMessage(IntToStr(SI));

  LI := LI + SI;

  ShowMessage(IntToStr(LI));

end;

LoL 1. Dez 2004 09:04

Re: String->Smallint
 
Warum kommt dann das bei mir:?

[Error] main.pas(525): Incompatible types: 'Integer' and 'Smallint'

Sharky 1. Dez 2004 09:06

Re: String->Smallint
 
Zeige doch mal etwas Code.

LoL 1. Dez 2004 09:08

Re: String->Smallint
 
hmm... komisch
ich hab mal delphi neu gestartet jetzt gehts :gruebel:
Sorry für die komische Frage :zwinker:


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