How To Check If A String Is Numeric In Java

This example show you how to check if a string content is numeric or not. It provide totally six methods to use. package com.dev2qa.calculatorexample; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * Created by zhaosong on 2018/5/23. */ public class CheckStringNumeric { public static void main(String args[]) { CheckStringNumeric checkStringNumeric = new CheckStringNumeric(); checkStringNumeric.isNumeric(“-123.45”); checkStringNumeric.isInteger(“-123”); checkStringNumeric.isIntegerByParse(“-123.456”); checkStringNumeric.isDoubleByParse(“-123.456789”);

How To Check If A String Is Numeric In Java Read More »