Registriert seit: 6. Apr 2005
10.109 Beiträge
|
Re: im OnExit Event den String hinter dem Komma auffüllen au
19. Feb 2006, 22:45
Hallo Jürgen,
hier ein wenig Code für dich - mach was draus:
Delphi-Quellcode:
function ParseStr(var s: string; delimiters: string; purge: boolean = true): string;
var
i: integer;
begin
i := 0;
while (i < Length(s)) and (Pos(s[Succ(i)], delimiters) = 0) do
Inc(i);
Result := Copy(s, 1, i);
Delete(s, 1, i + Ord(purge));
end;
function StrToMinutes(s: String): Cardinal;
begin
Result := StrToInt(ParseStr(s, TimeSeparator)) * 60;
if s <> '' then
Result := Result + StrToInt(ParseStr(s, TimeSeparator));
end;
function MinutesToStr(minutes: Cardinal): String;
begin
Result := Format('%d:%.2d', [minutes div 60, minutes mod 60]);
end;
procedure TDemoForm.EditExit(Sender: TObject);
begin
with Sender as TEdit do
Text := MinutesToStr(StrToMinutes(Text));
end;
Gute Nacht
marabu
|
|
Zitat
|