Home > How-To Library > Coding Basics
How to use Like() function
**************************************************************** * © 2007 CodeItBetter http://www.codeitbetter.com * * This notice MUST stay intact for legal use * **************************************************************** 'Like() function used for Pattern-Matching in Code Dim strTest As String strTest = "@ciSmith v. Barney, 21 A2d 459, 35 ME2d 256 (1985)@ec" 'The following comparisons will result in True or False results as indicated: Result = strTest Like "*F2d*" '(Result would be False) Result = strTest Like "*A2d*" '(Result would be True) Result = strTest Like "@ci*@ec" '(Result would be True) 'One glitch is that It doesn't recognized "[0-9]@" whereas it will recognize 'particular occurrences of the character class. "[0-9][0-9][0-9]"
If you would like to submit your code here please us. Do not forget to mention your name. We are always thankful to each and everyone of you who submitted their code here.