Registriert seit: 27. Mai 2005
Ort: Baden
315 Beiträge
Delphi 2007 Enterprise
|
Re: Kleine Non-VCL Fragen
18. Dez 2006, 16:04
Delphi-Quellcode:
function IntToStr(i: Integer): String;
begin
Str(i, Result);
end;
function StrToInt(S: String): Integer;
begin
Val(S, Result, Result);
end;
function FloatToStr(E: Extended): String;
begin
Str(E:2:2, Result);
Result := ReplaceChar(Result, '.', ',');
end;
function StrToFloat(S: String): Extended;
var
I: Integer;
begin
Val(S, Result, I);
end;
function ReplaceChar(S: String; Old, New: Char): String;
var
i, j: Integer;
begin
for j := 0 to Length(S) do
begin
i := Pos(Old, S);
if i > 0 then
S[i] := New;
end;
Result := S;
end;
|
|
Zitat
|