zoukankan
html css js c++ java
(转)ArrayList 与 string[] 的转换
ArrayList 与 string[] 的转换
Method1:
Code
public
string
[] ToArray
ArrayList list
=
new
ArrayList();
list.Add(
"
aaa
"
);
list.Add(
"
bbb
"
);
//
转换成数组
string
[] arrString
=
(
string
[])list.ToArray(
typeof
(
string
) ) ;
Method2:
Code
ArrayList list
=
new
ArrayList();
list.Add(
"
aaa
"
);
list.Add(
"
bbb
"
);
//
转换成数组
string
[] arrString
=
new
string
[list.Count];
for
(
int
i
=
0
; i
<
list.Count ; i
++
){
arrString[i]
=
list[i].ToString();
}
将string转换成ArrayList类型:
Code
string
str
=
"
1,2,3,4,5
"
;
ArrayList b
=
new
ArrayList( str.Split(
'
,
'
) ) ;
查看全文
相关阅读:
Python
Python
Python
Python
Python
Python
Python
python
对象
py常用模块
原文地址:https://www.cnblogs.com/fjchenqian/p/1386197.html
最新文章
GitLab简单操作
快速启动电脑安装的服务
已知字典中某几个key,取每个key对应的值
如何使用F12来模拟弱网测试
Python使用新值替换旧值
python3.configparser用法
怎么使用Python创建文件并编辑?
Python怎么获取excle中指定行和列的值?
人人开源fast-vue的所有坑踩了一个遍
docker下虚拟机之间的通讯
热门文章
Docker安装Elasticsearch
nginx解决跨域问题
天气工具
定时清理文件及文件夹
ZipUtils
解压方式安装jdk
list分组统计
校验提示语智能提示项目名称
Python
Python
Copyright © 2011-2022 走看看