Here you can find the source of convertStringToInt(String number)
Return the Integer value of the input string.
Parameter | Description |
---|---|
number | number in String type |
public static Integer convertStringToInt(String number)
//package com.java2s; public class Main { /**//from www.jav a 2s. c o m * <p> * Return the Integer value of the input string. * </p> * * @param number * number in String type * @return * the number in Integer type, return null * if the number can not be converted to Integer * type. */ public static Integer convertStringToInt(String number) { if (number == null) { return null; } try { return Integer.parseInt(number); } catch (NumberFormatException e) { return null; } } }