473,378 Members | 1,370 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Command for (IF variable LIKE ListOfWords)?

Hi,

is there a command which lets me compare a Variable to a whole list of words?

Instead of

IF (variable LIKE "*example1*") OR (variable LIKE "*example2*) OR...

I would like to write it shorter, somewhat like

IF (variable IN (*example1*,*example2*,...).

Is there a way to do this?

Best regards,

Jennifer Borck
Jul 17 '05 #1
2 11842
I tend to use :-

I = InStr( "*fred*joe*bert*boris*" , "*" + X$ + "*" )

On 25 Jun 2003 00:43:56 -0700, je******@freenet.de (Jennifer Bo)
wrote:
Hi,

is there a command which lets me compare a Variable to a whole list of words?

Instead of

IF (variable LIKE "*example1*") OR (variable LIKE "*example2*) OR...

I would like to write it shorter, somewhat like

IF (variable IN (*example1*,*example2*,...).

Is there a way to do this?

Best regards,

Jennifer Borck


Jul 17 '05 #2
Hello Jennifer,

You could do it like this:

Select Case X$
Case "Fred", "Joe", "Bert", "Boris"
Case Else
MsgBox "None of the above names"
End Select
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Glen | last post by:
Hi, I just have a quick question Im trying to initialize a string (or char) variable with the information created by the output of a shell (or DOS) command.. Example: I want to execute a...
15
by: Sokar | last post by:
Hello, I am writing a script which is using the system() command. In the script the system command invokes an encryption with system("gpg -f file.txt"). The problem comes when the script is...
6
by: Stuart Norris | last post by:
Dear Readers, I am attempting to initialise a struct contiaing a dynamic character string. In the example below I am trying to initialise the name field so that my struct does not waste space. ...
7
by: Aaron | last post by:
Complete code follows. I am new to .NET programming (and programming in general) and I am having a difficult time understanding how to fill a variable in one sub, and then access it from...
3
by: Ken | last post by:
I would like to programmatically use the command line argument in vb dot net. In vb6 it was easy, you just use the Command$ variable. How do I use it in vb dot net? Any help would be appreciated.
3
by: jlw16 | last post by:
Hello, I’m trying to use my vbs script to get a command line argument for a file which will need to be opened through QuickTestPro. Below are the commands I’m using: Dim qt_file 'As String ->...
0
by: ycollet | last post by:
Hello, I'm trying to write a program to send python statements to a python server via tcp and then get back results via a tcp connection. It nearly works ... but I'm totally lost with the...
13
by: Chris Carlen | last post by:
Hi: Having completed enough serial driver code for a TMS320F2812 microcontroller to talk to a terminal, I am now trying different approaches to command interpretation. I have a very simple...
0
by: Cameron Simpson | last post by:
On 17Aug2008 21:25, John Nagle <nagle@animats.comwrote: Because $HOSTNAME is a bash specific variable, set by bash but NOT EXPORTED! Like $0 and a bunch of other "private" variables, subprocesses...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.