示例#1
0
 //Write a Boolean method that extracts the digits from a string
 //representing a phone number and
 //confirms that it contains exactly 10 digits.
 public static bool ValidatePhoneNumber(string input)
 {
     return(YKStringUtilities.RemovePunctuation(input).Length == 10);
 }
示例#2
0
 //Write a Boolean method that extracts the digits from a string
 //representing a US Zip Code and
 //confirms that it contains either 5 or 9 digits.
 //This should be a one-liner.
 public static bool ValidateUPZipCode(string input)
 {
     return(YKStringUtilities.RemovePunctuation(input).Length == 5 || YKStringUtilities.RemovePunctuation(input).Length == 9);
 }