myStrToFloat
function myStrToFloat(const myStr: string; var myResult: Real): Boolean;
var
myTempStr: string;
ResultStr: string;
myChar: Char;
myPos, myLen: integer;
begin
myPos := 1;
ResultStr := '';
myTempStr := Trim(myStr);
myLen := Length(myTempStr);
while myPos <= myLen do
begin
myChar := myTempStr[myPos];
if not (myChar in ['0'..'9', '.', '+', '-']) then Break;
if (myChar in ['+', '-']) and (myPos > 1) then Break;
if (myChar = '.') and (AnsiPos('.', ResultStr) <> 0) then Break;
ResultStr := ResultStr + myChar;
myPos := myPos + 1;
end;
if ResultStr = '' then
begin
myResult := 0.0;
Result := False;
end
else
begin
try
myResult := StrToFloat(ResultStr);
Result := True;
except
myResult := 0.0;
Result := False;
end;
end;
end;