Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

VB Script doing a like comparison

Posted on 2014-08-20
3
Medium Priority
?
140 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?
0
Comment
Question by:tim_carter
  • 2
3 Comments
 
LVL 28

Accepted Solution

by:
omgang earned 2000 total points
ID: 40274199
Vbscript Instr Function.

http://msdn.microsoft.com/en-us/library/wybb344c(v=vs.84).aspx

intFound = InStr(adapter.Name, "local area connection")
If intFound <> 0 Then


OM Gang
0
 
LVL 1

Author Closing Comment

by:tim_carter
ID: 40274221
Thanks works great. Just have to take into account upper and lowercase
0
 
LVL 28

Expert Comment

by:omgang
ID: 40274238
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
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses
Course of the Month21 days, 3 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question