[Débutant] Conversion d'un String en Int
Bonjour, j'ai un p'ti probleme de conversion en fait je donne un string a la methode Integer.parseInt et il me renvoie l'exception
Code:
For input String "12"
Code:
1 2 3 4 5 6 7 8 9 10 11 12
|
try{
//nombre est un char[]
String t=new String(nombre);
System.out.println(t);//affiche mon string
int resultat=Integer.parseInt(t);
System.out.println("c bon!!!");
return true;
}catch(NumberFormatException e){
System.out.println(e.getMessage());
System.out.println("tu t vu kan ta bu!");
} |
Merci bcp