|
-
Nov 17th, 2000, 06:56 PM
#1
Thread Starter
Hyperactive Member
Hey, how would i put ANYTHING
between 2 "'s into a variable
like:
"Nobody Knows"
then Variable(1) = Nobody Knows
but it could be anyamount of words, 1 or 15, it doesn't matter
THANKS
-
Nov 17th, 2000, 07:03 PM
#2
Frenzied Member
Use
Code:
MsgBox """Hello"""
OR
MsgBox Chr(34) & "Hello" & Chr(34)
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Nov 17th, 2000, 07:37 PM
#3
Thread Starter
Hyperactive Member
i guess i didn't explain it enough..
i mean like, i have a textbox, and if someone types something like
"yo" i said, and he said "what up"
var(1) = yo
var(2) = what up
..
so what ever is INBETWEEN 2 "'s would go into a variable..
and i could have many variables..
Thanks
-
Nov 18th, 2000, 11:22 PM
#4
Can you explain yourself just a bit more? What do you mean so what ever is INBETWEEN 2 "'s would go into a variable.. ?
Do you mean spaces? You could use the split function, put it into arrays.
Code:
Private Sub Command1_Click()
Dim vArray As Variant
Dim strArray As String
Dim iArray As Integer
vArray = Split(Text1.Text, " ")
For i = 0 To UBound(vArray)
strArray = strArray & vArray(iArray) & vbCrLf
Next i
MsgBox strArray
End Sub
^should get you started.
Chr(34) = " 'quote
-
Nov 19th, 2000, 10:15 AM
#5
Hyperactive Member
I think this is what you want!
I put them into a dynamic array.
Code:
Private Sub Command1_Click()
Dim I As Integer, ArrLen As Integer
Dim Vars() As String
ArrLen = -1
For I = 1 To Len(Text1.Text)
If Mid(Text1.Text, I, 1) = Chr(34) Then
ArrLen = ArrLen + 1
ReDim Preserve Vars(ArrLen)
Vars(ArrLen) = Mid(Text1.Text, I + 1, InStr(I + 1, Text1.Text, Chr(34)) - I - 1)
I = InStr(I + 1, Text1.Text, Chr(34)) + 1
End If
Next
End Sub
For instance the sentance : "I am testing" to see "if" this "works" will end up like this:
Vars(0) = I am testing
Vars(1) = if
Vars(2) = works
Is that what you want? Or am I as confused as the rest of them?
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
|