Vampsoft: Parse Text Function
![Visual Basic 6, or VB Classic Visual Basic 6, or VB Classic](https://www.fortypoundhead.com//assets/img/icons/v7/vb6.png)
Parses a Line of Text, Great for Chats...
Example Layout
String = "[Hello] [This] [is] [an] [Example] [Layout]"
Original Author: Lostsoul
Code
Dim xText(10) As String
Dim total As Integer
Sub ParseText(Text As String)
Dim x As Integer
x = 0
For i = 1 To Len(Text) 'do Until i = the length of the string
xText(x) = "" 'Make sure there is nothing in it already
If Mid$(Text, i, 1) = "[" Then 'Check for a Start Bracket '['
i = i + 1 'Add One to I so you don't get the Bracket
Do
xText(x) = xText(x) + Mid$(Text, i, 1) 'Added the leter at i in text to xtext at x
i = i + 1 'NExt letter
Loop Until Mid$(Text, i, 1) = "]" 'loop till you find a end bracket ']'
x = x + 1 'Add 1 to x for the next element in xText
total = total + 1 'keep track of total.
End If
Next i
End Sub
Private Sub Form_Load()
total = 0
Call ParseText("[Word0] [Word1] [Word2] [Word3] [Word4] [Word5] [Word6]")
For i = 0 To total - 1
MsgBox "xText(" & i & "): " & xText(i)
Next i
Loading Comments ...
Comments
No comments have been added for this post.
You must be logged in to make a comment.