1234567891011121314151617181920212223242526272829303132 |
- /* ==============================================================================
- * 功能描述:只能接受整数,包括正数和负数
- * 创 建 者:Garrett
- * 创建日期:2018/2/28 14:53:43
- * ==============================================================================*/
- using System.Text.RegularExpressions;
- namespace WPG.MBIPropType
- {
- public class AccessInteger : BaseTextInputControl
- {
- public override bool InputControl(string fullText)
- {
- if (fullText == null)
- {
- return false;
- }
- string pattern = @"^\-?(0|([1-9]\d*))$";
- Regex regex = new Regex(pattern);
- if (fullText.Length != 1)
- {
- return regex.IsMatch(fullText);
- }
- if (!"-".Equals(fullText) && !regex.IsMatch(fullText))
- {
- return false;
- }
- return true;
- }
- }
- }
|