Check if given string is number with dot separator and two decimals : Digit Number « Regular Expressions « Java
- Java
- Regular Expressions
- Digit Number
Check if given string is number with dot separator and two decimals
public class Main {
public static boolean isNumberWith2Decimals(String string) {
return string.matches("^\\d+\\.\\d{2}$");
}
public static void main(String[] args) {
sysout isNumberWith2Decimals("1234.123")
}
}
Related examples in the same category