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

+21
View File
@@ -0,0 +1,21 @@
using System.Text.RegularExpressions;
namespace Algorithms.IdCard;
public class TelephonNumber
{
private string telephonNumber;
public TelephonNumber(string telephonNumber)
{
this.telephonNumber = telephonNumber;
}
public bool IsValid(){
Regex rx = new Regex(@"^(\+?1 )?\d{3} \d{3}-\d{4}$");
return rx.Match(this.telephonNumber).Success;
}
}