delphi memo1 数字列设定取值范围  
官方Delphi 学习QQ群: 682628230(三千人)\n
频道

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

推荐分享
图文皆来源于网络,内容仅做公益性分享,版权归原作者所有,如有侵权请告知删除!
 

Copyright © 2014 DelphiW.com 开发 源码 文档 技巧 All Rights Reserved
晋ICP备14006235号-8 晋公网安备 14108102000087号

执行时间: 0.040083885192871 seconds