vb中split函数实例
1个回答
展开全部
Dim str As String = "", temp, n As Integer
Dim str1 As String = "12,45,2,9,41,31,66,83,2,1,-9,-91,-21"
Dim a() As String = Split(str1, ",")
For i = 1 To UBound(a) Step 1
a(i) = Val(a(i))
Next
temp = 0
n = 0
For i = 1 To UBound(a)
If a(i) > temp Then
temp = a(i)
End If
If a(i) > 0 Then
n = n + 1
End If
Next
str = str & "正数的个数为 " & n
str = str & "最大元素的下标为 "
For i = 1 To UBound(a)
If a(i) = temp Then
str = str & i & " "
End If
Next
TextBox6.Text = str
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询