Integer.parse(String str) java.lang.NumberFormatException: Errors

前端 未结 8 1610
一整个雨季
一整个雨季 2020-12-11 22:18

I keep getting number format expectations, even though I\'m trimming the strings and they don\'t contain non numerical characters bizarrely it works for some numbers and not

8条回答
  •  失恋的感觉
    2020-12-11 22:56

    You could use

    String n="3020857508";
    Long a = Long.valueOf(n.trim()).longValue();
    System.out.println(a);
    

提交回复
热议问题