By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,986 Members | 1,522 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,986 IT Pros & Developers. It's quick & easy.

Split settings

P: 3
Hello... I have a question about Split function:
I need to split text ("ABCDEFGH") in letters.. and what I have to write in "Delimiter of string"??
for e.g.
Expand|Select|Wrap|Line Numbers
  1. Split("ABCDEFGH", "", 1)
isn't working. :(

PS.: Sorry about my english.
Nov 23 '06 #1
Share this Question
Share on Google+
5 Replies


P: 3
I found out:
Expand|Select|Wrap|Line Numbers
  1. variable.Substring(i, 1)
But now is another problem... How can i add this value to array?
e.g.
my_array(i) = variable.Substring(i, 1)

can I put "i" in array value id?
Nov 23 '06 #2

P: 3
As far as i know it would have to be my_array(0) = variable.Substring(i, 1) , A number not i
Nov 23 '06 #3

100+
P: 267
As far as i know it would have to be my_array(0) = variable.Substring(i, 1) , A number not i
hi

suppose your string strValue holds "2,e,f,5,6,h,u"

then

array=split(strValue,",") 2nd argument is delimiter

first item of the array will be array(0), value 2 etc
Nov 24 '06 #4

Expert 5K+
P: 8,434
I found out:
variable.Substring(i, 1)
But now is another problem... How can i add this value to array?
e.g.
my_array(i) = variable.Substring(i, 1)
can I put "i" in array value id?
What you need to do is write a loop to go through one character at a time. Something along these lines...
Expand|Select|Wrap|Line Numbers
  1. S = "ABCDEFGH"
  2. For i = 1 To Len(S)
  3.   my_array(i) = Mid(S, i, 1)
  4. Next
However, this is VB6 code. From the Substring you've used, I suspect you're using VB.Net. They are similar in some ways, different in others. The same sort of logic should apply here though - loop through the characters, placing them into the array elements.

As albertw pointed out, to use Split there has to be some delimiter character in the string, on which to split. Such as spaces between words, or commas netween data fields, etc.
Nov 24 '06 #5

100+
P: 1,646
I found out:
Expand|Select|Wrap|Line Numbers
  1. variable.Substring(i, 1)
But now is another problem... How can i add this value to array?
e.g.
my_array(i) = variable.Substring(i, 1)

can I put "i" in array value id?
Hi. Try this;
Expand|Select|Wrap|Line Numbers
  1. Dim ar() As String
  2. Dim MyString As String
  3. Dim i As Integer
  4.  
  5. MyString = "ABCDEFGHIJK"
  6. ReDim ar(Len(MyString) - 1)
  7.  
  8. For i = 0 To UBound(ar)
  9.    ar(i) = MyString.Substring(i + 1, 1)
  10. Next i
  11.  
Nov 24 '06 #6

Post your reply

Sign in to post your reply or Sign up for a free account.