Here you can find the source of isNumeric(String string)
Parameter | Description |
---|---|
string | string to test |
public static boolean isNumeric(String string)
//package com.java2s; public class Main { /**/*from ww w . j av a 2 s . c o m*/ * Tests if a string is numeric, i.e. contains only digit characters * * @param string * string to test * @return true if only digit chars, false if empty or null or contains * non-digit chrs */ public static boolean isNumeric(String string) { if (string == null || string.length() == 0) return false; int l = string.length(); for (int i = 0; i < l; i++) { if (!Character.isDigit(string.codePointAt(i))) return false; } return true; } }