Android String to Int Convert string2Int(String str)

Here you can find the source of string2Int(String str)


string Int


public static int string2Int(String str) 

Method Source Code

//package com.java2s;

public class Main {

    public static int string2Int(String str) {
        try {//from w w  w. j  av a  2  s . co m
            int value = Integer.valueOf(str);
            return value;
        } catch (Exception e) {
            // TODO: handle exception
            return 0;


  1. toInt(String str, int defValue)
  2. toInteger(String value)
  3. toNumber(String str)
  4. amount2String(String amount)
  5. String2Int(String str)
  6. isTextInteger(String texto)
  7. getInt(String str, int defaultValue)
  8. getIntFromStr(String str)
  9. getIntValue(String str)