Java Integer Parse tryParseInt(String s)

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

Description

try Parse Int

License

Open Source License

Declaration

public static int tryParseInt(String s) 

Method Source Code

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

public class Main {
    public static int tryParseInt(String s) {
        try {//from  w w w .j a  v  a2 s. c  om
            return Integer.parseInt(s);
        } catch (NumberFormatException e) {
            return -1;
        }
    }
}

Related

  1. tryParseInt(Object o)
  2. tryParseInt(Object obj, Integer defaultVal)
  3. tryParseInt(String intString, int defaultValue)
  4. tryParseInt(String num)
  5. tryParseInt(String str)
  6. tryParseInt(String str, int defaultValue)
  7. tryParseInt(String stringInt)
  8. tryParseInt(String text)