Skip to content

Instantly share code, notes, and snippets.

@wellington1993
Forked from martinusso/IsEmptyOrNull.pas
Created August 27, 2018 19:54
Show Gist options
  • Save wellington1993/c7daaadd011990df27c5265819eb90cc to your computer and use it in GitHub Desktop.
Save wellington1993/c7daaadd011990df27c5265819eb90cc to your computer and use it in GitHub Desktop.
Check if Variant is empty or null in Delphi
// uses System, Variants
function IsEmptyOrNull(const Value: Variant): Boolean;
begin
Result := VarIsClear(Value) or VarIsEmpty(Value) or VarIsNull(Value) or (VarCompareValue(Value, Unassigned) = vrEqual);
if (not Result) and VarIsStr(Value) then
Result := Value = '';
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment