Android examples for java.util.regex:Numeric Pattern
match Float value by regex
//package com.java2s; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { private static final String V_FLOAT = "^([+-]?)\\d*\\.\\d+$"; public static boolean Float(String value) { return match(V_FLOAT, value); }/* www . ja v a 2 s . co m*/ private static boolean match(String regex, String str) { Pattern pattern = Pattern.compile(regex); Matcher matcher = pattern.matcher(str); return matcher.matches(); } }