unit1.~pas

来自「keyishixianshuruzifuchuandetongjigongzuo」· ~PAS 代码 · 共 61 行

~PAS
61
字号
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Memo1: TMemo;
    Label1: TLabel;
    Label2: TLabel;
    Button1: TButton;
    Label3: TLabel;
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var
  s:string;
  i,e,c,t:integer;
begin
  s:=memo1.text;
  e:=0;c:=0;t:=0;
  for i:=1 to length(s) do
  begin
    if (ord(s[i])>=33)and(ord(s[i])<=126) then
    begin
      inc(e);
      edit1.Text := inttostr(e);
    end
    else if (ord(s[i])>=127) then
    begin
      inc(c);
      edit2.text :=inttostr(c div 2);
    end
    else if (ord(s[i])>=0)and (ord(s[i])<=9) then
    begin
      inc(t);
      edit3.Text :=inttostr(t);
      end
  end;
end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?