Java examples for java.lang:String Parse
Is String a Number
//package com.java2s; public class Main { public static void main(String[] argv) { String stra = "java2s.com"; System.out.println(IsNumber(stra)); }//from www . j a v a 2 s. c o m /** * * @param stra * input * @return is number */ public static boolean IsNumber(final String stra) { try { if (stra == null || "".equalsIgnoreCase(stra)) { return false; } Long.parseLong(stra); } catch (Exception ex) { return false; } return true; } }