-
Notifications
You must be signed in to change notification settings - Fork 1
/
SysUtils_.pas
61 lines (52 loc) · 1.31 KB
/
SysUtils_.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
unit SysUtils_;
interface
{
// XProger: uses SysUtils äëÿ ÷åãî òîãäà? ;)
type
TFloatValue = (fvExtended, fvCurrency);
TFloatFormat = (ffGeneral, ffExponent, ffFixed, ffNumber, ffCurrency);
}
function StrPas(s: PChar): string;
function StrToFloat(const S: string; var X: single): boolean;
function FloatToStr(X: single): string;
//function Trim(s: string): string;
implementation
uses SysUtils;
function StrPas(s: PChar): string;
begin
// XProger: LOL
//Result:=SysUtils.StrPas(s);
Result := s;
end;
function StrToFloat(const S: string; var X: single): boolean;
var
X1 : Extended;
begin
// XProger: äàâàé óæ ðåøèì êàêîé ñåïåðàòîð áóäåò... :)
//à âîò íèôèãà, ïðîñòî ÿ è äðóãèå ÷àñòî îøèáàþòñÿ.
if pos('.', s) > 0 then
DecimalSeparator := '.'
else
DecimalSeparator := ',';
// XProger: òàê èçâðàùàòüñÿ ãîðàçäî íàä¸æíåå è áûñòðåå
X1 := X;
Result := SysUtils.TextToFloat(PChar(S), X1, fvExtended);
X := X1;
end;
function FloatToStr(X: single): string;
begin
DecimalSeparator := ',';
Result := FloatToStrF(X, ffGeneral, 5, 5);
end;
// XProger: øóòíèê ;)
{
function Trim(s: string): string;
begin
while (length(s)>0) and (s[1]=' ') do
Delete(s, 1, 1);
while (length(s)>0) and (s[length(s)]=' ') do
Delete(s, length(s), 1);
Result:=s;
end;
}
end.