\d*\.?\d?
\
"\\d*\\.?\\d?"
@"\d*\.?\d?"
public static bool isFloatValue(string text){Regex regex = new Regex(@"^\d*\.?\d?$");return regex.IsMatch(text);} void Main(){ Console.WriteLine(isFloatValue("12.5")); Console.WriteLine(isFloatValue("12.5.")); Console.WriteLine(isFloatValue("12")); Console.WriteLine(isFloatValue(".1")); Console.WriteLine(isFloatValue("12."));}
TrueFalseTrueTrueTrue
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)