I need to do a phone number validation that the tel# contains only: numbers 0-9 left and right parenthesis hyphen blank space
in c#
this is my code for now:
//ValidatePhoneNumber
public static string ValidatePhoneNumber(string v_strPhoneNumber)
{
const string strPHONE_NUMBER_BLANK =
"Phone Number cannot be blank";
const string strPHONE_NUMBER_TOO_LONG =
"Phone Number cannot be longer than 24 characters";
if (v_strPhoneNumber.Trim().Length == 0)
return strPHONE_NUMBER_BLANK;
if (v_strPhoneNumber.Trim().Length > 24)
return trPHONE_NUMBER_TOO_LONG;
return String.Empty;
}//end ValidatePhoneNumber
I need to add that validation into that code, I am a beginer so the easiest way possible would be great. If you can give me the answer please if you could at least point me in the right direction, Thanks!