如果可以将字符串参数转换为int数组,则需要对其进行验证。
String pattern = "(\\d+[,])+";
String test = "18,32,5,8,10";
test2.matches(pattern2) //returns false as i requires , in the end
Run Code Online (Sandbox Code Playgroud)
有什么办法可以忽略最后一个','
| 归档时间: |
|
| 查看次数: |
1520 次 |
| 最近记录: |