Parse String into Number

前端 未结 6 1668
迷失自我
迷失自我 2020-12-31 04:51

I have a list which will store Number objects. The list will be populated by parsing a list of strings, where each string may represent any subclass of Number.

How d

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-31 05:06

    you can obtain Number from String by using commons.apache api -> https://commons.apache.org/proper/commons-lang/javadocs/api-3.4/index.html

    Usage:

    String value = "234568L";  //long in the form string value
    Number number = NumberUtils.createNumber(value);
    

提交回复
热议问题