NeGueSa
asked on
How do I convert a string to an array from Visual studio 2005 "VB codebehind"
How do I convert a string to an array from Visual studio 2005 "VB codebehind"
Let say I have a label which contain following string :
"'ABC', 'DEF', 'GHI', 'JKL', 'MNO'"
I nee to convert this as an Array, can anybody helps?
Let say I have a label which contain following string :
"'ABC', 'DEF', 'GHI', 'JKL', 'MNO'"
I nee to convert this as an Array, can anybody helps?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Or try this?
Dim i As Integer
Dim str As String
str = "'ABC', 'DEF', 'GHI', 'JKL', 'MNO'"
Dim aryStr() = str.Split(",")
For i = 0 To aryStr.Length - 1
Console.WriteLine((aryStr( i).ToStrin g().Trim() ))
Next
hongjun
Dim i As Integer
Dim str As String
str = "'ABC', 'DEF', 'GHI', 'JKL', 'MNO'"
Dim aryStr() = str.Split(",")
For i = 0 To aryStr.Length - 1
Console.WriteLine((aryStr(
Next
hongjun
Or to throw yet another variant in the mix:
Dim myArray() As String = {"'ABC'","'DEF'","'GHI'"," 'JKL'","'M NO'"}
Dim myArray() As String = {"'ABC'","'DEF'","'GHI'","
Dim string1(5) as string
This allows you to do the following, and store it as an array:
string(1) = "ABC"
string(2) = "DEF"
Is this what you are looking for?