|
-
Dec 30th, 2000, 01:05 PM
#1
Thread Starter
Member
Can someone please clarify about the InStr command, how it works, an example and will it work with arrays.
Thanks
cram
[email protected]
_ _ _ _ _ _ _ _ _ _ _ _ _ _
Things to Ponder

|Man who stands on toilet,
Is high On pot|
|Baseball Wrong,
Man with four balls cannot walk|
-
Dec 30th, 2000, 01:10 PM
#2
It searches for a string within another string.
Code:
Str1 = "This is a string"
Str2 = "is"
If InStr(1, Str1, Str2) > 0 Then MsgBox "Str2 is found in Str1"
What do you mean by work with Array's? If you loop through each element in the array then yes, it will work.
-
Dec 30th, 2000, 01:23 PM
#3
Thread Starter
Member
what I meant was instead of using str1 in your example, can you use an array?
cram
[email protected]
_ _ _ _ _ _ _ _ _ _ _ _ _ _
Things to Ponder

|Man who stands on toilet,
Is high On pot|
|Baseball Wrong,
Man with four balls cannot walk|
-
Dec 30th, 2000, 01:30 PM
#4
Addicted Member
yes..
like:
Code:
Dim Array1(1) As String
Array1(0) = "This is a String"
Array1(1) = "is"
If InStr(1, Array1(0), Array1(1)) > 0 Then
MsgBox Array1(1) & " is found in " & Array1(0)
Else
MsgBox Array1(1) & " is not found in " & Array1(0)
End If
-
Dec 30th, 2000, 01:37 PM
#5
Frenzied Member
Code:
Dim x&
Dim Arr(1) As String
Arr(0) = "Hello"
Arr(1) = "I'm Jop"
For x = 0 to Ubound(Arr)
if Instr(1, Arr(0), "Jop") then MsgBox "Array " & x & "contains Jop!"
next x
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
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
|