mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-12 20:31:15 +02:00
* optimized for speed UpCase/LowerCase for UnicodeChar, based on a patch by AlexeyT, resolves #32638
git-svn-id: trunk@37625 -
This commit is contained in:
parent
46ab35edb3
commit
a650d346f1
@ -1325,11 +1325,14 @@ end;
|
||||
{$ifndef FPC_HAS_UPCASE_UNICODECHAR}
|
||||
{$define FPC_HAS_UPCASE_UNICODECHAR}
|
||||
Function UpCase(c:UnicodeChar):UnicodeChar;
|
||||
var
|
||||
s : UnicodeString;
|
||||
begin
|
||||
s:=c;
|
||||
result:=widestringmanager.UpperUnicodeStringProc(s)[1];
|
||||
if (word(c)>=Ord('a')) and (word(c)<=Ord('z')) then
|
||||
Result:= UnicodeChar(word(c)-32)
|
||||
else
|
||||
if word(c)>=128 then
|
||||
Result:= widestringmanager.UpperUnicodeStringProc(UnicodeString(c))[1]
|
||||
else
|
||||
Result:= c;
|
||||
end;
|
||||
{$endif FPC_HAS_UPCASE_UNICODECHAR}
|
||||
|
||||
@ -1346,11 +1349,14 @@ end;
|
||||
{$ifndef FPC_HAS_LOWERCASE_UNICODECHAR}
|
||||
{$define FPC_HAS_LOWERCASE_UNICODECHAR}
|
||||
Function LowerCase(c:UnicodeChar):UnicodeChar;
|
||||
var
|
||||
s : UnicodeString;
|
||||
begin
|
||||
s:=c;
|
||||
result:=widestringmanager.LowerUnicodeStringProc(s)[1];
|
||||
if (word(c)>=Ord('A')) and (word(c)<=Ord('Z')) then
|
||||
Result:= UnicodeChar(word(c)+32)
|
||||
else
|
||||
if word(c)>=128 then
|
||||
Result:= widestringmanager.LowerUnicodeStringProc(UnicodeString(c))[1]
|
||||
else
|
||||
Result:= c;
|
||||
end;
|
||||
{$endif FPC_HAS_LOWERCASE_UNICODECHAR}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user