Delphi XE -TCharHelper

2021-03-07 16:29

阅读:332

标签: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


评论


亲,登录后才可以留言!