* Avoid memory allocation in IsNullOrWhitespace. Fix issue #39702

This commit is contained in:
Michaël Van Canneyt 2022-05-05 12:04:52 +02:00
parent beb97b8110
commit cab37732c4

View File

@ -311,8 +311,15 @@ end;
class function TStringHelper.IsNullOrWhiteSpace(const AValue: string): Boolean;
const
LWhiteSpace = [#0..' '];
var
I: SizeInt;
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;