mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2026-01-06 07:30:53 +01:00
* val takes care of empty string, patch from Petr Kristan
git-svn-id: trunk@10609 -
This commit is contained in:
parent
95aaa7a74b
commit
347ae5a3bf
@ -765,12 +765,18 @@ Function InitVal(const s:shortstring;out negativ:boolean;out base:byte):ValSInt;
|
||||
var
|
||||
Code : SizeInt;
|
||||
begin
|
||||
{Skip Spaces and Tab}
|
||||
code:=1;
|
||||
negativ:=false;
|
||||
base:=10;
|
||||
if length(s)=0 then
|
||||
begin
|
||||
InitVal:=code;
|
||||
Exit;
|
||||
end;
|
||||
{Skip Spaces and Tab}
|
||||
while (code<=length(s)) and (s[code] in [' ',#9]) do
|
||||
inc(code);
|
||||
{Sign}
|
||||
negativ:=false;
|
||||
case s[code] of
|
||||
'-' : begin
|
||||
negativ:=true;
|
||||
@ -779,7 +785,6 @@ begin
|
||||
'+' : inc(code);
|
||||
end;
|
||||
{Base}
|
||||
base:=10;
|
||||
if code<=length(s) then
|
||||
begin
|
||||
case s[code] of
|
||||
@ -1388,3 +1393,4 @@ begin
|
||||
ShortCompareText := L1 - L2;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user