码迷,mamicode.com
首页 > Windows程序 > 详细

Delphi XE -TCharHelper

时间:2020-05-03 12:52:54      阅读:74      评论:0      收藏:0      [点我收藏+]

标签:view   begin   form   ati   slow   The   create   sys   object   

// 它们定义在 System.Character, 它可以彻底替代同单元的 TCharacter 结构体. 主要方法有:
function IsControl: Boolean;
function IsDigit: Boolean;
function IsHighSurrogate: Boolean;
function IsInArray(const SomeChars: array of Char): Boolean;
function IsLetter: Boolean;
function IsLetterOrDigit: Boolean;
function IsLower: Boolean;
function IsLowSurrogate: Boolean;
function IsNumber: Boolean;
function IsPunctuation: Boolean;
function IsSeparator: Boolean;
function IsSurrogate: Boolean;
function IsSymbol: Boolean;
function IsUpper: Boolean;
function IsWhiteSpace: Boolean;
function ToLower: Char;
function ToUpper: Char;
function ToUCS4Char: UCS4Char;

// 以后可以不用 CharInSet()了, 不过得引用 System.Character 单元

uses
  System.Character;

procedure TForm1.FormCreate(Sender: TObject);
begin
  KeyPreview := True;
end;

procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
begin
//  if Key.IsInArray([‘1‘, ‘2‘, ‘3‘, ‘4‘, ‘5‘, ‘6‘, ‘7‘, ‘9‘, ‘0‘]) then
//    ShowMessage(‘按下了数字键‘);

  if Key.IsNumber then
    ShowMessage(‘真的按下了数字键‘);
end;

  

Delphi XE -TCharHelper

标签:view   begin   form   ati   slow   The   create   sys   object   

原文地址:https://www.cnblogs.com/redhat588/p/12821208.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!