Java中的String.replace

时间:2013-05-28 11:39:59

标签: replaceall

如何转换string

st = "[123, 123, 134,    90]"

进入

s = "123 123 134 90"

2 个答案:

答案 0 :(得分:1)

将“”替换为“”

将“,”改为“”

将“[”替换为“”

将“]”替换为“”

答案 1 :(得分:0)

感谢Maroun Maroun

String st = "[123, 123, 134, 90]"

String s = st.replaceAll("\\["," ").replaceAll("\\]"," ").replaceAll(","," ");