Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我收到了值 = 1.0.0 的字符串,但是,当字符串值拆分时,我的字符串 [] 是 [] 没有值!!
String vS = getValue(); String[] str = vS.trim().split(".");
但在调试模式下,vS 值是:1、.0、.0 不知道为什么?!
这是因为该split()方法使用正则表达式并且.是匹配任何字符的正则表达式。将其更改为:
split()
.
String[] str = vS.trim().split("[.]");