help files
Z505 | PasWiki | FUQ | Search | Main Docs | API Guide



[Overview][Constants][Types][Procedures and functions][Variables] Reference for unit 'oldlinux' (#rtl)

FNMatch

Check whether filename matches wildcard specification

Declaration

Source position: oldlinux.pp line 1585

function FNMatch(

  const Pattern: String;

  const Name: String

):Boolean;

Description

FNMatch returns True if the filename in Name matches the wildcard pattern in Pattern, False otherwise.

Pattern can contain the wildcards * (match zero or more arbitrary characters) or ? (match a single character).

Errors

None.

See also

FSearch

  

Search for file in search path.

FExpand

  

Expand filename to fully qualified path

Example

Program Example69;

{ Program to demonstrate the FNMatch function. }

Uses oldlinux;

  Procedure TestMatch(Pattern,Name : String);

  begin
    Write ('"',Name,'" ');
    If FNMatch (Pattern,Name) then
      Write ('matches')
    else
      Write ('does not match');
    Writeln(' "',Pattern,'".');
  end;

begin
  TestMatch('*','FileName');
  TestMatch('.*','FileName');
  TestMatch('*a*','FileName');
  TestMatch('?ile*','FileName');
  TestMatch('?','FileName');
  TestMatch('.?','FileName');
  TestMatch('?a*','FileName');
  TestMatch('??*me?','FileName');
end.

Notes

 No notes exist for this page yet. 





lufdoc, Powtils, fpc, freepascal, delphi, kylix, c/c++, mysql, cgi web framework docs, Z505