|
-
Jan 5th, 2002, 10:24 PM
#1
Thread Starter
Junior Member
separating the word
i have a word at a string:
x = "book"
and i want to do this:
x1 = "b"
x2 = "o"
x3 = "o"
x4 = "k"
but the string changes and I don't know to do this because one time is 4 letters but other time is 5 letters.
any help??
thank's
-
Jan 5th, 2002, 10:29 PM
#2
PowerPoster
VB Code:
Dim x() As String
Dim strData As String
Private Sub Command1_Click()
strData = "book"
i = Len(strData)
ReDim x(i)
For y = 1 To Len(strData)
x(y) = Mid(strData, y, 1)
Print x(y)
Next
End Sub
-
Jan 5th, 2002, 10:30 PM
#3
Member
An array.
VB Code:
Const s As String = "book"
Dim Letters() As String
ReDim Letters(0 To Len(s))
Dim i As Integer
For i = 0 To Len(s)
Letters(i) = Mid$(s, i, 1)
Next i
-
Jan 5th, 2002, 10:49 PM
#4
Hyperactive Member
A slightly different approach you could use that might be a bit faster, but less convienient, it to use StrConv to make a byte array of the ascii codes of the characters. You'd have to use Chr$ on each letter then though.
IE
Dim Bytes() as Byte
Bytes() = StrConv(Text, vbFromUnicode)
would give you an array called bytes containing the ascii codes of each character.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|