From 0da16e7dbe7576492e729f7a8661936834a11f2f Mon Sep 17 00:00:00 2001 From: marco Date: Sun, 27 Jan 2019 14:52:52 +0000 Subject: [PATCH] * unicode version of isleadchar. utf8 still to follow, see #34754 git-svn-id: trunk@41085 - --- rtl/objpas/sysutils/syswide.inc | 6 ++++++ rtl/objpas/sysutils/syswideh.inc | 3 +++ 2 files changed, 9 insertions(+) diff --git a/rtl/objpas/sysutils/syswide.inc b/rtl/objpas/sysutils/syswide.inc index 6135ece8e9..0b60f3a3a0 100644 --- a/rtl/objpas/sysutils/syswide.inc +++ b/rtl/objpas/sysutils/syswide.inc @@ -11,6 +11,11 @@ ********************************************************************* } +function IsLeadChar(Ch: WideChar): Boolean; +begin + Result := (Ch >= #$D800) and (Ch <= #$DFFF); +end; + function Trim(const S: widestring): widestring; var Ofs, Len: sizeint; @@ -180,6 +185,7 @@ begin result:=(Ch<=#$FF) and (ansichar(byte(ch)) in CSet); end; + {$macro on} {$define INWIDESTRINGREPLACE} {$define SRString:=WideString} diff --git a/rtl/objpas/sysutils/syswideh.inc b/rtl/objpas/sysutils/syswideh.inc index eff1af4690..2ad6ce00a0 100644 --- a/rtl/objpas/sysutils/syswideh.inc +++ b/rtl/objpas/sysutils/syswideh.inc @@ -35,3 +35,6 @@ function StrCopy(Dest, Source: PWideChar): PWideChar; overload; function StrLCopy(Dest,Source: PWideChar; MaxLen: SizeInt): PWideChar; overload; Function CharInSet(Ch:WideChar;Const CSet : TSysCharSet) : Boolean; function WideStringReplace(const S, OldPattern, NewPattern: WideString; Flags: TReplaceFlags): WideString; + +function IsLeadChar(Ch: WideChar): Boolean; inline; overload; +