DelphiFunc

W Turbo Pascalu brakuje użytecznych funkcji IntToStr oraz StrToInt. Zamiast męczyć się z proceduremi Str i Val, można utworzyć funkcje będące ich odpowiednikami. Te, i inne często używane funkcje można umieścić w unit'cie i korzystać z nich w swoich programach.

unit DelphiFunc;
interface
type bool = boolean;
function IntToStr(i : Integer) : string;
function StrToInt(s : String) : Integer;

implementation
function IntToStr(i : Integer) : String;
var s : String;
begin
Str(i, s);
IntToStr := s;
end;

function StrToInt(s : String) : Integer;
var i, c : Integer;
begin
Val(s, i, c);
if c <> 0 then i := 0;
StrToInt := i;
end;
end.

Podobne strony

Podobne Strony
Table of Contents
O ile nie zaznaczono inaczej, treść tej strony objęta jest licencją Creative Commons Attribution-ShareAlike 3.0 License