We help IT Professionals succeed at work.

Check out this week's podcast, "Dairy Farms to Databases: Community's Hand in Technology"Listen Now

x

VB Script doing a like comparison

157 Views
Last Modified: 2014-08-20
Hi Guys,

I am making a little network tool. I am looping through the network adapters. I would like to do a like comparison

So if I get an adapter that is named (local area connection) I want to know it even if it is called "local area connection 1" or local area connection 2 etc.

so something like

if adapter.Name like '%local area connection%' then.

I know that is SQL and it cant be done the same way. but how do I do that?
Comment
Watch Question

IT Manager
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Thanks works great. Just have to take into account upper and lowercase
omgangIT Manager
CERTIFIED EXPERT

Commented:
See the MSDN article.  The InStr function defaults to binary comparison but you can for text comparison so upper/lower case will match.

intFound = InStr(1, adapter.Name, "local area connection", 1)

OM Gang
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.