mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-27 11:17:28 +01:00
LazUtils: Rename function IsPureASCII to IsASCII which is semi-standard for such funcs. Related to commit 957f1d68.
This commit is contained in:
parent
45169753de
commit
cab4db5c42
@ -636,7 +636,7 @@ begin
|
||||
if (SrcChars='') or (s='') or (SrcChars=DstChars) then exit;
|
||||
|
||||
unique:=false;
|
||||
if IsPureAscii(SrcChars) and IsPureAscii(DstChars) then begin
|
||||
if IsAscii(SrcChars) and IsAscii(DstChars) then begin
|
||||
// search and replace single byte characters
|
||||
ReplaceASCII;
|
||||
exit;
|
||||
|
||||
@ -158,7 +158,8 @@ function UTF8WrapText(S, BreakStr: string; BreakChars: TSysCharSet; MaxCol, Inde
|
||||
function UTF8WrapText(S, BreakStr: string; BreakChars: TSysCharSet; MaxCol: integer): string; overload;
|
||||
function UTF8WrapText(S: string; MaxCol: integer): string; overload;
|
||||
|
||||
function IsPureAscii(S: string): Boolean; // String has only ASCII characters.
|
||||
function IsAscii(S: string): Boolean; // String has only ASCII characters.
|
||||
function IsPureAscii(S: string): Boolean; inline;
|
||||
|
||||
type
|
||||
// the order of enum items is used in Utf8EscapeControlChars!
|
||||
@ -306,7 +307,7 @@ begin
|
||||
{$IFDEF UTF8_RTL}
|
||||
Result:=s;
|
||||
{$ELSE}
|
||||
if NeedRTLAnsi and (not IsPureASCII(s)) then
|
||||
if NeedRTLAnsi and (not IsASCII(s)) then
|
||||
Result:=UTF8ToAnsi(s)
|
||||
else
|
||||
Result:=s;
|
||||
@ -318,7 +319,7 @@ begin
|
||||
{$IFDEF UTF8_RTL}
|
||||
Result:=s;
|
||||
{$ELSE}
|
||||
if NeedRTLAnsi and (not IsPureASCII(s)) then
|
||||
if NeedRTLAnsi and (not IsASCII(s)) then
|
||||
begin
|
||||
Result:=AnsiToUTF8(s);
|
||||
{$ifdef FPC_HAS_CPSTRING}
|
||||
@ -3380,7 +3381,7 @@ begin
|
||||
Result := UTF8WrapText(S, LineEnding, [' ', '-', #9], MaxCol);
|
||||
end;
|
||||
|
||||
function IsPureAscii(S: string): Boolean;
|
||||
function IsAscii(S: string): Boolean;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
@ -3390,6 +3391,11 @@ begin
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
function IsPureAscii(S: string): Boolean;
|
||||
begin
|
||||
Result := IsAscii(S);
|
||||
end;
|
||||
|
||||
function UTF8Trim(const s: string; Flags: TUTF8TrimFlags): string;
|
||||
var
|
||||
p: PChar;
|
||||
@ -4055,7 +4061,7 @@ end;
|
||||
|
||||
procedure TStringListUTF8Fast.InsertItem(Index: Integer; const S: string; O: TObject);
|
||||
begin
|
||||
if not IsPureAscii(S) then
|
||||
if not IsAscii(S) then
|
||||
begin
|
||||
// Non-ASCII string found, switch to Unicode mode.
|
||||
//WriteLn('TStringListUTF8Fast.InsertItem: Found non-ASCII string "'+S+'"');
|
||||
|
||||
@ -12,7 +12,7 @@ end;
|
||||
|
||||
function WinCPToUTF8(const s: string): string;
|
||||
begin
|
||||
if NeedRTLAnsi and (not IsPureAscii(s)) then
|
||||
if NeedRTLAnsi and (not IsAscii(s)) then
|
||||
begin
|
||||
Result:=AnsiToUTF8(s);
|
||||
{$ifdef FPC_HAS_CPSTRING}
|
||||
@ -27,7 +27,7 @@ end;
|
||||
|
||||
function UTF8ToWinCP(const s: string): string;
|
||||
begin
|
||||
if NeedRTLAnsi and (not IsPureAscii(s)) then
|
||||
if NeedRTLAnsi and (not IsAscii(s)) then
|
||||
Result:=UTF8ToAnsi(s)
|
||||
else
|
||||
Result:=s;
|
||||
|
||||
@ -320,7 +320,7 @@ var
|
||||
UTF16Str: UnicodeString;
|
||||
begin
|
||||
Result:=s;
|
||||
if IsPureASCII(Result) then begin
|
||||
if IsASCII(Result) then begin
|
||||
{$ifdef FPC_HAS_CPSTRING}
|
||||
// prevent codepage conversion magic
|
||||
SetCodePage(RawByteString(Result), CP_ACP, False);
|
||||
@ -355,7 +355,7 @@ var
|
||||
len: LongInt;
|
||||
begin
|
||||
Result:=s;
|
||||
if IsPureASCII(Result) then begin
|
||||
if IsASCII(Result) then begin
|
||||
{$ifdef FPC_HAS_CPSTRING}
|
||||
// prevent codepage conversion magic
|
||||
SetCodePage(RawByteString(Result), CP_ACP, False);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user