Android examples for java.util.regex:Number Pattern
is String Float number by regex
//package com.java2s; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static boolean isFloat(String str) { Pattern pattern = Pattern.compile("^(-?\\d+)(\\.\\d+)?$"); Matcher isNum = pattern.matcher(str); if (!isNum.matches()) { return false; }/*from w w w. j a v a 2 s.c o m*/ return true; } }