added new exercices
This commit is contained in:
1 parent
6b25e67c49
commit
c17800f71a
4 files changed
+96
No files matched your search
@@ -0,0 +1,17 @@
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Algorithms.IdCard;
|
||||
|
||||
public class PostalCode
|
||||
{
|
||||
private string postalCode;
|
||||
public PostalCode(string postalCode)
|
||||
{
|
||||
this.postalCode = postalCode;
|
||||
}
|
||||
|
||||
public bool IsValid(){
|
||||
Regex rx = new Regex(@"^[A-Z]\d[A-Z] \d[A-Z]\d$");
|
||||
return rx.Match(this.postalCode).Success;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user