Java Integer Parse tryParseInt(String value)

Here you can find the source of tryParseInt(String value)

Description

Try to parse the string as integer or return null if failed

License

Open Source License

Parameter

Parameter Description
value a parameter

Declaration

public static Integer tryParseInt(String value) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**//from w ww .j  av  a2s .c o  m
     * Try to parse the string as integer or return null if failed
     * 
     * @param value
     * @return
     */
    public static Integer tryParseInt(String value) {
        try {
            return Integer.parseInt(value);
        } catch (NumberFormatException e) {
            return null;
        }
    }
}

Related

  1. tryParseInt(String s)
  2. tryParseInt(String str)
  3. tryParseInt(String str, int defaultValue)
  4. tryParseInt(String stringInt)
  5. tryParseInt(String text)
  6. tryParseInt(String value)
  7. tryParseInteger(String intValue)
  8. tryParseInteger(String text)
  9. TryParseIntInvariant(String str, int[] n)