wildcard_file
Definition: | integer i = wildcard_file(string st1, string st2) |
Description: |
Return true (1) if the filename st2 matches the wild card pattern st1. Return false (0) otherwise. This is similar to DOS wildcard matching, but better in some cases. * matches any 0 or more characters, ? matches any single character. Character comparisons are not case sensitive. |
pwa/p2js: | Supported. |
Comments: | You might use this function to check the output of the dir()
routine for file names that match a pattern supplied by the
user of your program.
In DOS "*ABC.*" will match all files. wildcard_file("*ABC.*", s) will only match when the file name part has "ABC" at the end (as you would expect). |
Example 1: |
i = wildcard_file("AB*CD.?", "aB123cD.e") -- i is set to 1 |
Example 2: |
i = wildcard_file("AB*CD.?", "abcd.ex") -- i is set to 0, because the file type has 2 letters not 1 |
Implementation: | See builtins\wildcard.e (an autoinclude) for details of the actual implementation. |
See Also: | regex.e, wildcard_match, dir |