Android String to Int Convert parseInt(String arg, int defaultValue)

Here you can find the source of parseInt(String arg, int defaultValue)

Description

parse Int

Declaration

public static int parseInt(String arg, int defaultValue) 

Method Source Code

//package com.java2s;

public class Main {
    public static int parseInt(String arg, int defaultValue) {
        if (arg == null) {
            return defaultValue;
        }//from   www. j av  a2s.  co  m
        try {
            return Integer.parseInt(arg);
        } catch (NumberFormatException e) {
            return defaultValue;
        }
    }
}

Related

  1. getIntValue(String str)
  2. getFirstInteger(String value)
  3. tryParse(String value, int defaultValue)
  4. tryParse(String value, String defaultValue)
  5. parseInt(String str)
  6. stringToIntArray(String arrString, String separator)
  7. getIntegerArrayList(String strInput)
  8. validInt(CharSequence integer)
  9. parseIntOrZero(CharSequence charSequence)