Einzelnen Beitrag anzeigen

TiGü

Registriert seit: 6. Apr 2011
Ort: Berlin
3.060 Beiträge
 
Delphi 10.4 Sydney
 
#2

AW: ConvertToUtf32

  Alt 5. Jan 2021, 08:34
Die ConvertToUtf32-Funktionen sind class functions.
Die kannst du wie folgt anwenden:

Delphi-Quellcode:
program Project1;

{$APPTYPE CONSOLE}

{$R *.res}

uses
  System.Character;

var
  MyChar1, MyChar2: Char;
  MyUCS4Char: UCS4Char;

begin
// IsSurrogate(MyChar);
    MyChar1.IsSurrogate;
// MyUCS4Char := ConvertToUtf32(MyChar1, MyChar2);
    MyUCS4Char := Char.ConvertToUtf32(MyChar1, MyChar2);
end.
Siehe auch:
Delphi-Quellcode:
type
  TCharHelper = record helper for Char
  private
    class procedure RaiseCheckStringRangeException(Index, LowIndex, MaxIndex: Integer); static;
  public
    const
      MaxHighSurrogate = #$DBFF;
      MaxLowSurrogate = #$DFFF;
      MaxSurrogate = #$DFFF;
      MinHighSurrogate = #$D800;
      MinLowSurrogate = #$DC00;
      MinSurrogate = #$D800;
    class function MaxCodePoint: Integer; static;
    class function UnicodeDataVersion: string; static;

    class function ConvertFromUtf32(C: UCS4Char): string; static;
    class function ConvertToUtf32(const S: string; Index: Integer): UCS4Char; overload; inline; static;
    class function ConvertToUtf32(const S: string; Index: Integer; out CharLength: Integer): UCS4Char; overload; static;
    class function ConvertToUtf32(const HighSurrogate, LowSurrogate: Char): UCS4Char; overload; static;
...
  Mit Zitat antworten Zitat