store String chars or substrings in Array
-
how do i take A strings data and take all the chars or substrings and store them Array INDividualy... so say if the data in the string is HELLO THERE take H and store it to index 0 E store it to index 1 and so on and so forth even the space between HELLO and THERE.
-
how do i take A strings data and take all the chars or substrings and store them Array INDividualy... so say if the data in the string is HELLO THERE take H and store it to index 0 E store it to index 1 and so on and so forth even the space between HELLO and THERE.
-
how do i take A strings data and take all the chars or substrings and store them Array INDividualy... so say if the data in the string is HELLO THERE take H and store it to index 0 E store it to index 1 and so on and so forth even the space between HELLO and THERE.
String has a ToCharArray method. Christian Graus - Microsoft MVP - C++
-
how do i take A strings data and take all the chars or substrings and store them Array INDividualy... so say if the data in the string is HELLO THERE take H and store it to index 0 E store it to index 1 and so on and so forth even the space between HELLO and THERE.
Strings have a "Chars" property array, which is the string split into an array of characters, just like what you are wanting. For Example.
Dim S As String = "Test" S.Chars(0) ' contains T S.Chars(1) ' contains e S.Chars(2) ' contains s S.Chars(3) ' contains t
You can also use the "ToCharArray" function of a String to get a specific substring of the string and split it into a character array. For Example.Dim S As String = "Test" S.ToCharArray(2, 2) ' returns "st" because s is the the third index 'of "Test" (zero based array) and the length of the returned array (second 'parameter of the ToCharArray function) is 2.
Hope this helps, Scott "Some people spend an entire lifetime wondering if they made a difference. The Marines don't have that problem." ( President Ronald Reagan) -
Strings have a "Chars" property array, which is the string split into an array of characters, just like what you are wanting. For Example.
Dim S As String = "Test" S.Chars(0) ' contains T S.Chars(1) ' contains e S.Chars(2) ' contains s S.Chars(3) ' contains t
You can also use the "ToCharArray" function of a String to get a specific substring of the string and split it into a character array. For Example.Dim S As String = "Test" S.ToCharArray(2, 2) ' returns "st" because s is the the third index 'of "Test" (zero based array) and the length of the returned array (second 'parameter of the ToCharArray function) is 2.
Hope this helps, Scott "Some people spend an entire lifetime wondering if they made a difference. The Marines don't have that problem." ( President Ronald Reagan)yes this helps a bunch. so say if i wanted to do a loop that will stop as soon as i completed storing the chars in the array. Dim S As String S = "hello there" Dim I As Integer Dim Chars() as String I = 0; For i To S.Legnth Step +1 // don't know yet how i set that up S.Chars(0); Next do whateever... i don't know how am i attemping this, loops are still fuzzy to me but I have some grasp. -thanks George