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 |
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 |
|
|
1898 |
|
if Result then |
1899 |
|
begin |
1900 |
|
{adjust scale for decimal point} |
1901 |
< |
if ds > 0 then |
1902 |
< |
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; |