-
I am making a game, and am trying to get it so any incoming data is done right..
like in muds, but i dunno how to do it
unless someone can tell me how they do it, this is what i would like to use:
I would like to split some text
example:
hey guys what is up?
Turns into these varaibles
word1="hey"
word2="guys"
word3="what"
word4="is up?"
Soo, the first word is put into WORD1
second into word2
third into, word3
and ANY WORDS after it go into word4
If i could get this,, gREAT
Lastly
if it is possible
i'd like it also to be able to do:
Code:
hey guys what is up?
it turns out the same
word1="hey"
word2="guys"
word3="what"
word4="is up?"
so, the first 3 words come out the same, but the words 4 and after, keep the spaces
-
Text Handling
Code:
Dim Word(4), tmpText As String
Dim i, LastSpace As Integer
Dim MoreThanOneWord As Boolean
MoreThanOneWord = True
tmpText = TextToSplit
For i = 1 To 3
LastSpace = InStr(1, tmpText, " ")
If LastSpace = 0 Then
Word(i) = tmpText
MoreThanOneWord = False
Exit For
Else
Word(i) = Mid(tmpText, 1, LastSpace - 1)
tmpText = Mid(tmpText, LastSpace + 1)
End If
Next
If MoreThanOneWord Then Word(4) = tmpText
MsgBox Word(1) + Chr(13) + Word(2) + Chr(13) + Word(3) + Chr(13) + Word(4)
Hope It Helps..