* Empty string cannot be number

This commit is contained in:
michael 2021-06-11 05:33:16 +00:00
parent fb7dbfabe5
commit 5fef7a40d0

View File

@ -664,6 +664,11 @@ function valint(const S: String; MinVal, MaxVal: NativeInt; out Code: Integer):
var
x: double;
begin
if S='' then
begin
code:=1;
exit;
end;
x:=Number(S);
if isNaN(x) then
case copy(s,1,1) of
@ -694,6 +699,11 @@ procedure val(const S: String; out NI: NativeUInt; out Code: Integer);
var
x : double;
begin
if S='' then
begin
code:=1;
exit;
end;
x:=Number(S);
if isNaN(x) or (X<>Int(X)) or (X<0) then
Code:=1
@ -738,6 +748,11 @@ procedure val(const S : String; out d : double; out Code : Integer);
Var
x: double;
begin
if S='' then
begin
code:=1;
exit;
end;
x:=Number(S);
if isNaN(x) then
Code:=1