Skip to content
This repository was archived by the owner on Oct 23, 2024. It is now read-only.
This repository was archived by the owner on Oct 23, 2024. It is now read-only.

数值字符串末尾带有小数点0转换为整数出现NumberFormatException #2830

@jsvnadmin

Description

@jsvnadmin

直接看代码
`
JSONObject jsonObject = JSONObject.parseObject("{"qty":"10.0"}");

int qty = jsonObject.getIntValue("qty");
`
字符串转换为数值的时候,可不可以自动去掉后面是 .0 的,再转。这样就不怕有错误。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions