vb.net怎么把一个string字符串转换成string数组
比如dimaasstring="abc"dimbasstring()然后把A的ABC分别输入到B(0)B(1)B(2)...
比如
dim a as string = "abc"
dim b as string()
然后把A的ABC分别输入到B(0)B(1)B(2) 展开
dim a as string = "abc"
dim b as string()
然后把A的ABC分别输入到B(0)B(1)B(2) 展开
4个回答
展开全部
dim a as string="a,b,c"
dim b()as string
b=split(a,",")
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
for i = 1 to Len(a)
b(i - 1) = Mid(a, i, 1)
Next
结果:
b(0) = "a"
b(1) = "b"
b(2) = "c"
b(i - 1) = Mid(a, i, 1)
Next
结果:
b(0) = "a"
b(1) = "b"
b(2) = "c"
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Dim a As String = "abc"
Dim b As String()
ReDim b(a.Length)
For i = 1 To a.Length
b(i - 1) = Mid(a, i, 1)
Next
Dim b As String()
ReDim b(a.Length)
For i = 1 To a.Length
b(i - 1) = Mid(a, i, 1)
Next
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
符合VB.NET习惯的转换方式如下:
Dim a As String = "abc"
Dim b() As String
Dim c() As Char = a.ToCharArray()
Dim i As Integer
ReDim b(a.Length - 1)
For i = 0 To a.Length - 1
b(i) = c(i).ToString
Next
Dim a As String = "abc"
Dim b() As String
Dim c() As Char = a.ToCharArray()
Dim i As Integer
ReDim b(a.Length - 1)
For i = 0 To a.Length - 1
b(i) = c(i).ToString
Next
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询