|
-
Feb 16th, 2006, 10:20 AM
#1
Thread Starter
Hyperactive Member
Wildcard??
Hello 
How would I, in an If - Then statement, use a wildcard in certain locations. For example:
VB Code:
If String = "String_" & [b]Wildcard[/b] Then
Thanks,
Rudi
-
Feb 16th, 2006, 10:26 AM
#2
Re: Wildcard??
You can't really use patterns like that in direct string comparisons. The String class has some members that can help in simple cases, like StartsWith, EndsWith, IndexOf, IndexOfAny, LastIndexOf and LastIndexOfAny. Anything more complex than what those can do is going to require the use of regular expressions through the Regex class, which is an all-powerful pattern matching mechanism. Some regular expressions can get pretty complex but you can match basically any pattern you can think of.
-
Feb 16th, 2006, 10:27 AM
#3
Thread Starter
Hyperactive Member
Re: Wildcard??
That's fine, thanks alot
-
Feb 16th, 2006, 11:30 AM
#4
Re: Wildcard??
You could use the LIKE operator;
VB Code:
IF "string1" LIKE "string*" THEN
...
END IF
TPM
Add yourself to the VBForums Frappr Map!!
-
Feb 16th, 2006, 11:46 AM
#5
Re: Wildcard??
Well I'll be b*ggered! I take back everything I said (do you think anyone noticed ). The stupid thing is I've even used Like myself, but not for quite some time and I'd forgotten it even existed. Time for a memory upgrade I'd say. Might get a new case while I'm at it. This old one's looking a bit shabby.
-
Feb 16th, 2006, 11:48 AM
#6
Re: Wildcard??
If you need help with your upgrade come to GPC
TPM
Add yourself to the VBForums Frappr Map!!
-
Feb 16th, 2006, 12:27 PM
#7
Thread Starter
Hyperactive Member
Re: Wildcard??
Thanks alot -TPM-, but the one that jmcilhinney sent to me works perfectly fine, and does exactly what I want to do 
Thanks again
-
Feb 16th, 2006, 01:18 PM
#8
Re: Wildcard??
No problem! (BTW: forgot to say the * can go anywhere, not just the end)
TPM
Add yourself to the VBForums Frappr Map!!
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
|