Diese Methode validiert eine deutsche Postleitzahl.
/// <summary>
/// Determines whether the specified input is a german zipcode
/// </summary>
/// <param name="canditate">The canditate.</param>
/// <returns>
/// <c>true</c> if [is german zipcode] [the specified canditate]; otherwise, <c>false</c>.
/// </returns>
static bool IsGermanZipcode(string canditate)
{
System.Text.RegularExpressions.Regex pattern = new System.Text.RegularExpressions.Regex(@"^\d{5}$");
return pattern.IsMatch(canditate.Trim());
}
2 Kommentare zum Snippet