c# - How to match a file path with a file search pattern (i.e. *.jpg)? -
I know that all files that match the search pattern in a folder like this:
directoryinfo folderinfo = new directoryinfo (folderpath); Fileinfo [] fileInfos = folderInfo.GetFiles (disassembly); But my problem is, if I already know the file path, how can I match it to the search pattern? For compatibility, the search pattern should have the same format as * .jpg or something.
Your question is interpreted as meaning, that is, you already have a file path There is a string and just to see if it matches a certain pattern, for that you first have to consider whether you need to actually pattern patterning, for example it would be better to use the extension directly.
Considering that there is no alternative, you probably want to use regular expression to convert the string into a regular expression with a wild card. Unfortunately, I am not aware of any of the ways of doing this, but it is possible to avoid any such characters that would be appropriate in Reggae and replace the wild card with proper regular expressions.
Comments
Post a Comment