首页 > 开发 > 综合 > 正文

根据文本文件获得每行字符串的数组

2024-07-21 02:23:28
字体:
来源:转载
供稿:网友
'根据文本文件获得每行字符串的数组

function getlinestrbytxtfile(byval txtfilename as string) as arraylist

dim fs as io.filestream = new io.filestream(txtfilename, io.filemode.open, io.fileaccess.read)

dim sr as io.streamreader = new io.streamreader(fs, system.text.encoding.getencoding("gb2312"))

dim arraystr as array = sr.readtoend().split(vbcrlf)

dim i as integer : dim tmlist as new arraylist

for i = 0 to arraystr.length - 1

tmlist.add(arraystr.getvalue(i))

next

fs.close() : return tmlist

end function


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表