我有以下字符串
[http://images.com/1.jpg, http://images.com/2.jpg, http://images.com/3.jpg]
我想将此数组的内容存储在字符串数组或字符串类型的数组列表中。
我尝试使用.split方法,但失败主要是因为字符串开头还包含括号。
最佳答案
String[] splittedString = theString.substring(1, theString.length()-1).split(", ")
注意 split 方法中逗号后面的空格。
关于java - 将字符串转换为带括号的数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15545515/