Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Java中有这样的东西吗?
NSString *myString = [myArray componentsJoinedByString:@", "];
这是一些输出的示例:
A, B, C, D
如果没有,实现此目的的最佳方法是什么?
使用TextUtils.join():
TextUtils.join()
String myArray[] = new String[]{ "A", "B", "C", "D" }; String myString = TextUtils.join(", ", myArray);
如果您需要加入类似.IterableArrayList
Iterable
ArrayList