Java examples for java.lang:String Parse
string To Int
//package com.java2s; public class Main { public static void main(String[] argv) throws Exception { String s = "java2s.com"; System.out.println(strToInt(s)); }//from w w w . jav a 2 s .com public static int strToInt(String s) { int val = 0; try { val = Integer.parseInt(s); } catch (Exception ex) { val = 0; } return val; } }