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,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;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user