![]() |
Octal zu Integer und umgekehrt
Hallo,
hiermit kann man ein IntegerWert und eine Octalzahl umwandeln.
Delphi-Quellcode:
Und so Aufrufen:
function OctToInt(sValue: String): LongInt;
var iFor, iRes: Integer; begin iRes := 0; for iFor := 1 to Length(sValue) do begin // iRes := iRes * 8 +StrToInt(Copy(sValue, iFor, 1)); iRes := iRes * 8 +(Byte(sValue[iFor]) - Byte('0')); //Besserer Vorschlag von jbg end; Result := iRes; end;
Delphi-Quellcode:
Grüsse, Daniel :hi:
procedure TForm1.Button3Click(Sender: TObject);
begin ShowMessage(IntToStr(OctToInt('77'))); end; |
Re: Octal zu Integer und umgekehrt
Hallo,
hier ist auch schon das Gegenstück dazu:
Delphi-Quellcode:
So aufrufen:
function IntToOct(iValue: LongInt): String;
var iRest: LongInt; sOct: String; iFor: Integer; begin sOct := ''; while iValue > 0 do begin iRest := iValue mod 8; iValue := iValue div 8; sOct := IntToStr(iRest) + sOct; end; Result := sOct; end;
Delphi-Quellcode:
Grüsse, Daniel :hi:
procedure TForm1.Button3Click(Sender: TObject);
begin ShowMessage(IntToOct(100)); end; |
Re: Octal zu Integer und umgekehrt
Zitat:
Delphi-Quellcode:
Und noch schneller:
StrToInt(sValue[iFor]));
Delphi-Quellcode:
(Byte(sValue[iFor]) - Byte('0'));
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 03:43 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