is String All Number - Android java.lang

Android examples for java.lang:Character

Description

is String All Number

Demo Code


import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {

  public static boolean isAllNumber(String content) {

    Pattern p = Pattern.compile("\\-*\\d+");
    Matcher m = p.matcher(content);
    return m.matches();
  }/*from   ww  w  .  j ava2  s. c  om*/

}

Related Tutorials