-
Apr 20th, 2004, 06:29 PM
#1
Thread Starter
Frenzied Member
searching a string
forgot the function to search for a string within a string...how do i do that again?
-
Apr 20th, 2004, 06:31 PM
#2
Frenzied Member
-
Apr 20th, 2004, 06:38 PM
#3
Thread Starter
Frenzied Member
so i have 2 strings, i want to find choice in StringCompare
If InStr(1, choice, StringComp, vbBinaryCompare) <> True Then
so i'll do that? that will tell me if its not found?
-
Apr 20th, 2004, 07:25 PM
#4
The Instr() function returns a Long!
And, reverse the Search and String.
So, try:
VB Code:
If InStr(1, StringComp, choice , vbBinaryCompare) <> 0 Then ' Match found
Bruce.
-
Apr 20th, 2004, 07:42 PM
#5
Thread Starter
Frenzied Member
what if i don't know where it starts?
-
Apr 20th, 2004, 07:50 PM
#6
If you use the 'comparison' argument, you have to include a 'start'.
In that example, it starts at the front end of the string, and will return the first match position.
If you need repeditive search, then return the Instr position and use that next time around as the 'start' position.
(Also see InstrRev (VB6))
Bruce.
-
Apr 20th, 2004, 07:52 PM
#7
Thread Starter
Frenzied Member
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
|