如何拆分逗号分隔的字符串?
我有一个长度未知的字符串,看起来像这样
"dog, cat, bear, elephant, ..., giraffe"
在逗号处划分此字符串的最佳方法是什么,以便每个单词都可以成为ArrayList的元素?
例如
List<String> strings = new ArrayList<Strings>();
// Add the data here so strings.get(0) would be equal to "dog",
// strings.get(1) would be equal to "cat" and so forth.