ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/branches/udr/client/IBUtils.pas
(Generate patch)

Comparing ibx/trunk/fbintf/IBUtils.pas (file contents):
Revision 353 by tony, Sat Oct 23 14:11:37 2021 UTC vs.
Revision 356 by tony, Sun Oct 24 14:00:52 2021 UTC

# Line 1864 | Line 1864 | begin
1864    {$IFEND}
1865    {$IFEND}
1866    begin
1867    {ThousandSeparator not allowed as by Delphi specs}
1868    if (ThousandSeparator <> DecimalSeparator) and
1869       (Pos(ThousandSeparator, S) <> 0) then
1870        Exit;
1871
1867      for i := length(S) downto 1 do
1868      begin
1869        if S[i] = AnsiChar(DecimalSeparator) then
1870        begin
1871            if ds <> 0 then Exit; {only one allowed}
1872 <          ds := i-1;
1872 >          ds := i;
1873            dec(exponent);
1874            system.Delete(S,i,1);
1875        end
1876        else
1877 <      if (i > 1) and (S[i] in ['+','-']) and not (S[i-1] in ['e','E']) then
1878 <          Exit {malformed}
1877 >      if S[i] in ['+','-'] then
1878 >      begin
1879 >       if (i > 1) and not (S[i-1] in ['e','E']) then
1880 >          Exit; {malformed}
1881 >      end
1882        else
1883        if S[i] in ['e','E'] then {scientific notation}
1884        begin
# Line 1890 | Line 1888 | begin
1888        end
1889        else
1890        if not (S[i] in ['0'..'9']) then
1891 +      {Note: ThousandSeparator not allowed by Delphi specs}
1892            Exit; {bad character}
1893      end;
1894  
# Line 1899 | Line 1898 | begin
1898        if Result then
1899        begin
1900          {adjust scale for decimal point}
1901 <        Scale := Scale - (exponent - ds - 1);
1901 >        if ds <> 0 then
1902 >          Scale := Scale - (exponent - ds);
1903          Result := TryStrToInt64(system.copy(S,1,exponent-1),Value);
1904        end;
1905      end
1906      else
1907      begin
1908        if ds <> 0 then
1909 <        scale := ds - Length(S);
1909 >        scale := ds - Length(S) - 1;
1910        Result := TryStrToInt64(S,Value);
1911      end;
1912    end;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines