Java – How to check if a String is numeric
Few Java examples to show you how to check if a String is numeric. 1. Character.isDigit() Convert a String into a char array and check it with Character.isDigit() NumericExample.java package com.mkyong; public class NumericExample { public static void main(String[] args) { System.out.println(isNumeric("")); // false System.out.println(isNumeric(" ")); // false System.out.println(isNumeric(null)); // false System.out.println(isNumeric("1,200")); // false System.out.println(isNumeric("1")); …