连接数组列表中的字符串
我有一个数组列表 ArrayList
在此我存储了从 xml 文件解析的 n 个名称。
现在,我需要从这个 ArrayList 中获取所有名称并将其存储在一个单独的中 字符串名称
以及每个名称之间的斜杠(/)
。
For eg firstname= {a, c,f,g,h,j,k}
现在我希望它如下名称= a/c/f/g/h/j/k
到目前为止我已经创建了一个for循环来按其大小从ArrayList获取值
String names;
for(int k=0;k<Appconstant.firstname.size();k++) {
names = Appconstant.firstname.get(k);
}
I have an array list ArrayList<String> firstname;
In this I am storing n number of names which have been parsed from an xml file.
Now from this ArrayList I need to take all the names and store it in a Single separateString names
along with a slash(/)
between of each names.
For eg firstname= {a, c,f,g,h,j,k}
Now i want it to be as follows names= a/c/f/g/h/j/k
So far I have created a for loop to get values from the ArrayList by its size
String names;
for(int k=0;k<Appconstant.firstname.size();k++) {
names = Appconstant.firstname.get(k);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
尽管您应该使用 StringBuilder 来代替。
Though you should be using a StringBuilder instead.
我的脑海里浮现出这样的事情:
Off the top of my head, but something like this: