- 人气:
- 放大
- 缩小
- 二维码
- 赞赏
delphi memo1 数字列设定取值范围
Memo1内容:
1
2
3
4
5
6
7
8
9
10
unit Unit2;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
type
TForm2 = class(TForm)
Memo1: TMemo;
Memo2: TMemo;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.Button1Click(Sender: TObject);
var
I: Integer;
begin
for I := 0 to Memo1.Lines.Count-1 do
begin
if (strtoint(Memo1.Lines.Strings[i])>=5) and (strtoint(Memo1.Lines.Strings[i])<=8) then
begin
Memo2.Lines.Add(Memo1.Lines.Strings[i]);
end;
end;
end;
end.
结果:
5
6
7
8