mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-22 21:10:11 +02:00
* Avoid memory allocation in IsNullOrWhitespace. Fix issue #39702
This commit is contained in:
parent
beb97b8110
commit
cab37732c4
@ -311,8 +311,15 @@ end;
|
|||||||
|
|
||||||
|
|
||||||
class function TStringHelper.IsNullOrWhiteSpace(const AValue: string): Boolean;
|
class function TStringHelper.IsNullOrWhiteSpace(const AValue: string): Boolean;
|
||||||
|
const
|
||||||
|
LWhiteSpace = [#0..' '];
|
||||||
|
var
|
||||||
|
I: SizeInt;
|
||||||
begin
|
begin
|
||||||
Result:=system.Length(SysUtils.Trim(AValue))=0;
|
for I:=1 to System.Length(AValue) do
|
||||||
|
if not (AValue[I] in LWhiteSpace) then
|
||||||
|
exit(False);
|
||||||
|
Result:=True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user