微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

WinAPI 字符及字符串函数(5): IsCharAlpha - 是否是个字母

unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    Button4: TButton;
    Button5: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
  c: Char;
  b: BOOL;
begin
  c := #65; {A}
  b := IsCharalpha(c);
  ShowMessage(BoolToStr(b,True)); {True}
end;

procedure TForm1.Button2Click(Sender: TObject);
var
  c: Char;
  b: BOOL;
begin
  c := #97; {a}
  b := IsCharalpha(c);
  ShowMessage(BoolToStr(b,True)); {True}
end;

procedure TForm1.Button3Click(Sender: TObject);
var
  c: Char;
  b: BOOL;
begin
  c := #48; {0}
  b := IsCharalpha(c);
  ShowMessage(BoolToStr(b,True)); {False}
end;

procedure TForm1.Button4Click(Sender: TObject);
var
  c: Char;
  b: BOOL;
begin
  c := #13; {回车键}
  b := IsCharalpha(c);
  ShowMessage(BoolToStr(b,True)); {False}
end;

procedure TForm1.Button5Click(Sender: TObject);
var
  c: WideChar;
  b: BOOL;
begin
  c := #19975; {万}
  b := IsCharalpha(c);
  ShowMessage(BoolToStr(b,True)); {False}
end;

end.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐