怎么让一个字符串转换成字符串数组

QQ150900 2006-12-24 01:27:17
比如一个字符串:
hello
hello1
hello2
hello3

转换成一个有四个元素的字符串数组


...全文
202 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
hplyl 2007-04-05
  • 打赏
  • 举报
回复
谢了
QQ150900 2006-12-27
  • 打赏
  • 举报
回复
谢谢
dhxyxiaofeng 2006-12-24
  • 打赏
  • 举报
回复
单行的可以这样

Dim strTest As String = "hello,hello1,hello2,hello3"
Dim strArray() As String = strTest.Split(",")

Dim i As Int16

For i = 0 To UBound(strArray)
MsgBox(strArray(i))
Next
水如烟 2006-12-24
  • 打赏
  • 举报
回复
如果是取多行字串的字串组的话:
Public Shared Function GetResourceTextLine(ByVal resourceLine As String, ByVal removeCrLf As Boolean) As String()
Dim mItemLines As String()

mItemLines = resourceLine.Split(CChar(vbCrLf))

If removeCrLf Then
For i As Integer = 1 To mItemLines.Length - 1
mItemLines(i) = mItemLines(i).Replace(vbLf, String.Empty)
Next
End If

Return mItemLines
End Function
psj13840762457 2006-12-24
  • 打赏
  • 举报
回复
有现成的函数可用.好像叫SPIT什么的,我忘了,在MICROSOFT.VISTUAL下

16,552

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧