1 | unit UMainForm;
|
---|
2 |
|
---|
3 | interface
|
---|
4 |
|
---|
5 | uses
|
---|
6 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
---|
7 | Dialogs, UObjectString, UObjectInteger, UObjectBoolean, StdCtrls;
|
---|
8 |
|
---|
9 | type
|
---|
10 | TMainForm = class(TForm)
|
---|
11 | Button1: TButton;
|
---|
12 | Memo1: TMemo;
|
---|
13 | Button2: TButton;
|
---|
14 | Button3: TButton;
|
---|
15 | Button4: TButton;
|
---|
16 | procedure Button1Click(Sender: TObject);
|
---|
17 | procedure Button4Click(Sender: TObject);
|
---|
18 | private
|
---|
19 | { Private declarations }
|
---|
20 | public
|
---|
21 | { Public declarations }
|
---|
22 | end;
|
---|
23 |
|
---|
24 | var
|
---|
25 | MainForm: TMainForm;
|
---|
26 |
|
---|
27 | implementation
|
---|
28 |
|
---|
29 | {$R *.dfm}
|
---|
30 |
|
---|
31 | procedure TMainForm.Button1Click(Sender: TObject);
|
---|
32 | var
|
---|
33 | Operand1: TBoolean;
|
---|
34 | Operand2: TBoolean;
|
---|
35 | Result: TBoolean;
|
---|
36 | Int: TInteger;
|
---|
37 | begin
|
---|
38 | with Memo1, Lines do begin
|
---|
39 | Clear;
|
---|
40 | Operand1 := TBoolean.Create;
|
---|
41 | Operand2 := TBoolean.Create;
|
---|
42 | Result := TBoolean.Create;
|
---|
43 |
|
---|
44 | // Assign
|
---|
45 | Operand1.Value := True;
|
---|
46 | Result.Assign(Operand1);
|
---|
47 | Add(BoolToStr(Result.Value) + ' := ' + BoolToStr(Operand1.Value));
|
---|
48 |
|
---|
49 | Operand1.Value := False;
|
---|
50 | Result.Assign(Operand1);
|
---|
51 | Add(BoolToStr(Result.Value) + ' := ' + BoolToStr(Operand1.Value));
|
---|
52 |
|
---|
53 | // EqualTo
|
---|
54 | Operand1.Value := True;
|
---|
55 | Result.Value := True;
|
---|
56 | Result.EqualTo(Operand1);
|
---|
57 | Add(BoolToStr(Result.Value) + ' := ' + BoolToStr(Operand1.Value));
|
---|
58 |
|
---|
59 | // OrTo
|
---|
60 | Result.Value := True;
|
---|
61 | Operand1.Value := True;
|
---|
62 | Result.OrTo(Operand1);
|
---|
63 | Add(BoolToStr(Result.Value) + ' := ' + BoolToStr(Operand1.Value));
|
---|
64 | end;
|
---|
65 | end;
|
---|
66 |
|
---|
67 | procedure TMainForm.Button4Click(Sender: TObject);
|
---|
68 | var
|
---|
69 | Operand1: TString;
|
---|
70 | Operand2: TString;
|
---|
71 | Result: TString;
|
---|
72 | Int: TInteger;
|
---|
73 | Bool: TBoolean;
|
---|
74 | begin
|
---|
75 | with Memo1, Lines do begin
|
---|
76 | Clear;
|
---|
77 | Operand1 := TString.Create;
|
---|
78 | Operand2 := TString.Create;
|
---|
79 | Result := TString.Create;
|
---|
80 |
|
---|
81 | // EqualTo
|
---|
82 | Result.Value := 'Ab12=';
|
---|
83 | Operand1.Value := 'Ab12=';
|
---|
84 | Bool := Result.EqualTo(Operand1);
|
---|
85 | Add(BoolToStr(Bool.Value) + ' := ' + Result.Value + '.EqualTo(' + Operand1.Value + ')');
|
---|
86 |
|
---|
87 | Result.Value := 'Ab12=';
|
---|
88 | Operand1.Value := 'Ab12d=';
|
---|
89 | Bool := Result.EqualTo(Operand1);
|
---|
90 | Add(BoolToStr(Bool.Value) + ' := ' + Result.Value + '.EqualTo(' + Operand1.Value + ')');
|
---|
91 |
|
---|
92 | // Length
|
---|
93 | Result.Value := 'ABCD';
|
---|
94 | Int := Result.Length;
|
---|
95 | Add(IntToStr(Int.Value) + ' := ' + Result.Value + '.Length');
|
---|
96 |
|
---|
97 | // Reverse
|
---|
98 | Operand1.Value := 'ABCD';
|
---|
99 | Result.Assign(Operand1);
|
---|
100 | Result.Reverse;
|
---|
101 | Add(Result.Value + ' := ' + Operand1.Value + '.Reverse');
|
---|
102 |
|
---|
103 | // Pos
|
---|
104 | Operand1.Value := 'ABCD';
|
---|
105 | Operand2.Value := 'C';
|
---|
106 | Int := Operand1.Pos(Operand2);
|
---|
107 | Add(IntToStr(Int.Value) + ' := ' + Operand1.Value + '.Pos(' + Operand2.Value + ')');
|
---|
108 | end;
|
---|
109 | end;
|
---|
110 |
|
---|
111 | end.
|
---|