String Name = "yyyy MM DD abjwg kelk.exe"
public static bool IsNameRight(string Name)
{
string[] temp = Name.Split(' ');
string[] de= Name.Split('.');
if (de[1] == "pdf" && temp .Length == 5)
{
if (temp [0].Length == 4
&& temp [1].Length == 2
&& temp [3].Length == 2
&& temp [4] == "abjwg"
&& temp [5] == "kelk.exe")
return true;
else
return false;
}
return false;
}
I am using .NET 3.5 and C#
EDIT
You could use Regular expressions but I have never used it or know how to use it, and don't know if it is a good practice.
foo.pdf.exe
? \$\endgroup\$ – Jay Bazuzi Oct 26 '12 at 19:23