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

相关阅读 >>

Delphi tfilestream 打开模式与共享模式

cnpack sqlite tool 2.04

Delphi实现win10下Delphi 10.3.1 inline hook 调试器法获取寄存器并修改

Delphi 怎么计算一个memo中输入的汉字数目

Delphi 修改窗口标题

Delphi 用sql语句添加删除修改字段

Delphi 之 工具栏组件(ttoolbar)

Delphi一个简单的多线程例子

Delphi自带的indy控件实现md5加密

Delphi写入txt

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...