Delphi/CB
•  Greatis •  Security •  AppDatabase •  Utilities •  Visual Basic • .NET •  just4fun
Delphi / C++ Builder
Components, utilities and tips for Delphi and C++ Builder developers
Hot Offer
Save your money!
Featured
Ultimate Pack  hot!
Image Editor  new!
Runtime Fusion
Form Designer
Object Inspector
Print Suite Pro
Commented Image
Delphi Toys
WinDowse
Delphi Bonus
TMS Scripter Studio
Form Designer VB
Form Designer .NET

...get more...
for Delphi.NET, C#, VB.NET
for Delphi VCL, BCB 3-6

News Tips .NET Software VCL Software Partners  

Convert octal to decimal
Use function OctToDec to convert number in octal format to decimat format. It is not very difficult, because 217 in octal is 2*8*8+1*8+7 in decimal format.

function OctToDec(OctStr: string): string;
var
  DecNum: Real;
  i: Integer;
  Error: Boolean;
begin
  DecNum:=0;
  Error:=False;
  for i:=Length(OctStr) downto 1 do
  begin
    if not (OctStr[i] in ['0','1','2','3','4','5','6','7']) then
    begin
      Error:=True;
      ShowMessage('This is not octal number');
      Break;
    end;
    DecNum:=DecNum+StrToInt(OctStr[i])*Power(8, Length(OctStr)-i);
  end;
  if not Error then
    Result:=FloatToStr(DecNum)
  else Result:='';
end;

Related topics
Convert binary to octal
Convert octal to binary
Convert hexadecimal to binary
Convert binary to hexadecimal
Convert decimals to binary
Convert decimals to hexadecimals
Convert hexadecimals to decimals
Convert binary to decimals

For more
Delphi Help

Download source


Our Partner
DevArchive.com
Recommended
just4fun
Useful Resources
Win32.hlp Online
Unix Manual Pages
MegaDetailed.NET
in3steps.com
Newsletters
Subscribe to our news!    Subscribe to our news!


Greatis Software Greatis | Security | AppDatabase | Utilities | Delphi/CB | Visual Basic | .NET | just4fun

Contacts | Add to Favorites | Recommend to a Friend | Privacy Policy | Copyright © 1998-2008 Greatis Software