Here you can find the source of toInteger(String numericString)
Parameter | Description |
---|---|
numericString | a parameter |
public static Integer toInteger(String numericString)
//package com.java2s; public class Main { /**/* w w w . j a va2 s. c o m*/ * StringUtils.toInteger("") = 0, StringUtils.toInteger(null) = null, StringUtils.toInteger("367 ") = 367, * StringUtils.toInteger("someTextHere") = null * * @param numericString * @return Integer value */ public static Integer toInteger(String numericString) { if (numericString == null) return null; if (numericString.length() == 0) return Integer.valueOf(0); try { return Integer.parseInt(numericString.trim()); } catch (Exception e) { return null; } } }