【发布时间】:2019-03-12 07:02:40
【问题描述】:
我尝试使用 RegEx 将以下字符串 1.00 h. 转换为 1.00,但我是新手,需要您的帮助。我试过如下
seanceLengthValue = Integer.parseInt(
currentService.getSeanceLength().replaceAll("\\D\\w+",""));
【问题讨论】:
-
转换以下字符串“1.00 h”。使用 RegEx 到 1.00 -> 即使您获得 1.00,它仍然无法正常工作。无法将
1.00解析为 int。 -
@Evgeny Ladyzhenskiy:有任何答案对你有用吗?如果是,请考虑接受/支持他们。 What should I do when someone answers my question?