我有一个像这样的字符串:
String s = "first link, second link, third link, fourth link"
我想将它们分成一个单独的字符串,然后将其放在这样的字符串列表中:
List<String> s = ["first link","second link","third link","fourth link"]
该怎么做?
答案 0 :(得分:1)
签出Split方法以从字符串创建数组
使用您的示例:
String s = "first link, second link, third link, fourth link"
s.split(", "); // will return ['first link', 'second link', 'third link', 'fourth link'];