Hello :wave:
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 :)
Printable View
Hello :wave:
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 :)
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.
That's fine, thanks alot :D
You could use the LIKE operator;
VB Code:
IF "string1" LIKE "string*" THEN ... END IF
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.
:D
If you need help with your upgrade come to GPC ;)
Thanks alot -TPM-, but the one that jmcilhinney sent to me works perfectly fine, and does exactly what I want to do :D
Thanks again ;)
No problem! :) (BTW: forgot to say the * can go anywhere, not just the end)