Java Regex Number Validate isNumeric(String str)

Here you can find the source of isNumeric(String str)

Description

Tests whether a given string can be converted to an integer.

License

Open Source License

Parameter

Parameter Description
str a parameter

Declaration

protected static boolean isNumeric(String str) 

Method Source Code

//package com.java2s;
/**/*from  w ww  . jav  a 2 s.  c  om*/
 * Copyright (C) 2009  HungryHobo@mail.i2p
 * 
 * The GPG fingerprint for HungryHobo@mail.i2p is:
 * 6DD3 EAA2 9990 29BC 4AD2 7486 1E2C 7B61 76DC DC12
 * 
 * This file is part of I2P-Bote.
 * I2P-Bote is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * I2P-Bote is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with I2P-Bote.  If not, see <http://www.gnu.org/licenses/>.
 */

import java.util.regex.Pattern;

public class Main {
    /**
     * Tests whether a given string can be converted to an integer.
     * @param str
     */
    protected static boolean isNumeric(String str) {
        return Pattern.matches("\\d+", str);
    }
}

Related

  1. isNumberOfShownValue(String inputString)
  2. isNumeric(String as_argument)
  3. isNumeric(String input)
  4. isNumeric(String number)
  5. isNumeric(String s)
  6. isNumeric(String str)
  7. isNumeric(String str)
  8. isNumeric(String str)
  9. isNumeric(String str)