Search:

Type: Posts; User: copeg

Search: Search took 0.08 seconds.

  1. Replies
    17
    Views
    45,086

    Re: How to convert String to int

    Thanks for posting that code Json.
  2. Replies
    17
    Views
    45,086

    Re: How to convert String to int

    Good point. Out of curiosity though...according to this benchmark below going through the try/catch block is 10 times faster than validation (with correct input of course). For incorrect input the...
  3. Replies
    17
    Views
    45,086

    Re: How to convert String to int

    If you are unsure of the input, make sure to catch any NumberFormatExceptions that can be thrown when trying to parse something that can't be parsed

    public static void main(String[] args) {
    ...
Results 1 to 3 of 3