如何分割这个值并存储在arrey中? [英] how to split this value and store in arrey?
本文介绍了如何分割这个值并存储在arrey中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Dim str As String = ""
For i As Integer = 0 To CheckBoxList1.Items.Count - 1
If CheckBoxList1.Items(i).Selected Then
If str = "" Then
str = CheckBoxList1.Items(i).Value
Else
str += "," + CheckBoxList1.Items(i).Value
End If
End If
Next
str的值类似=12,13,14,15
怎么样拆分这个值并存储在arrey?
str has value like="12,13,14,15"
how to split this value and store in arrey?
推荐答案
你可以使用这样的东西...
you can use something like this...
Dim str As String = "12,54,125,148,87"
Dim arry As String() = str.TrimEnd(",").Split(",")
Dim TestArray()As String = Split(str,,)
Dim TestArray() As String = Split(str, ",")
使用如下
use as below
Dim str As String = ""
For i As Integer = 0 To CheckBoxList1.Items.Count - 1
If CheckBoxList1.Items(i).Selected Then
If str = "" Then
str = CheckBoxList1.Items(i).Value
Else
str += "," + CheckBoxList1.Items(i).Value
End If
End If
Next
Dim arry As String() = str.Split(",")
谢谢,
-RG
Thanks,
-RG
这篇关于如何分割这个值并存储在arrey中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文