溫馨提示×

vb中array函數(shù)的賦值方式有哪些

vb
小億
132
2024-02-19 12:23:19
欄目: 編程語言

在VB中,可以使用以下方法給數(shù)組賦值:

  1. 使用Array函數(shù):
Dim arr(2) As Integer
arr = Array(1, 2, 3)
  1. 直接賦值給數(shù)組的元素:
Dim arr(2) As Integer
arr(0) = 1
arr(1) = 2
arr(2) = 3
  1. 使用循環(huán)給數(shù)組賦值:
Dim arr(2) As Integer
For i = 0 To 2
    arr(i) = i + 1
Next i
  1. 使用Split函數(shù)將字符串分割為數(shù)組:
Dim arr() As String
arr = Split("apple,orange,banana", ",")

0