added new exercices

This commit is contained in:
didier amyot committed 2023-08-21 09:11:33 -04:00
1 parent 6b25e67c49
commit c17800f71a
4 files changed
+96

No files matched your search

+17
View File
@@ -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;
}
}