Check if a filename statement is masked in delphi

// Check if a filename statement is masked

{ —————————————————-

Identify a masked file name.
You can for example check for bad user input, if the file is to be created
—————————————————- }

function IsMaskedFileName(aFileName: string): Boolean;
begin
// First method
Result := (StrScan(PChar(aFileName), ‘*’) <> nil) or
(StrScan(PChar(aFileName), ‘?’) <> nil);

// Second way
Result := ((LastDelimiter(‘*?’, aFileName) <> 0);
end;