ylbtech-Code-Validator: Validate postal code |
1. Back to top |
1、
the using the System; namespace Sp.Common { public class ValidatorHelper { /// <Summary> /// authentication ZIP code /// </ Summary> /// <param name = "INPUT"> character string to be authenticated </ param > /// <returns> Whether it matches </ returns> public static bool IsZipCode ( string input) { // string pattern = @ "^ \ d {6} $"; // return IsMatch (input, pattern); if ( input.Length!= 6) return false; int i; if (int.TryParse(input, out i)) return true; else return false; } } }
2、
2. Back to top |
3. Back to top |
4. Back to top |
5. Back to top |
6. Back to top |
Author: ylbtech Source: http://ylbtech.cnblogs.com/ This article belongs to the author and blog Park total, welcome to reprint, but without the author's consent declared by this section must be retained, and given the original connection in the apparent position of the article page, otherwise Reserves the right to pursue legal responsibility. |