CSharp examples for System.Text.RegularExpressions:Match Number
Is Decimal by regex
using System.Text.RegularExpressions; using System.Text; using System.Reflection; using System.Linq; using System.Collections.Generic; using System;/*from ww w .j av a 2 s . c o m*/ public class Main{ public static bool IsDecimal(string input) { if (string.IsNullOrEmpty(input)) { return false; } return Regex.IsMatch(input, @"^\d+[.]?\d*$"); } public static bool IsNullOrEmpty(string value) { if (value == null) { return true; } return value.Trim().Length == 0; } }