The original with the following code
string FileNameWithOutSuffix1=Regex. Match (Files [I], @ "(? <=\ \ [# \ w \ \ - \ \ '\ \ \?? \] * (?=\.) "). The ToString ();
It's nice
Folder name, but recently a group of customers like to use., for example, 2020.10 (means folder name on behalf of their time)
But as a result, I the above code will fail, because in 2020 the name becomes
, please master action,
CodePudding user response:
System. IO. Path. GetFileName ()//access to the file name, including the suffixSystem. IO. Path. GetFileNameWithoutExtension ()//access to the file name, not including the suffix
System. IO. Path. GetExtension ()//get the suffix
CodePudding user response:
System. IO. Path. GetExtension () this method