Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBScript string compare

Status
Not open for further replies.

fterrazas

Technical User
Dec 29, 2000
43
0
0
ES
HI,I would like to know how can I compore to string variables, for example:

Var1="dog"
Var2="cat"
if (Var1=Var2) then
do something
else
do anything

Something like that, I can use the "=" operator? or how can I do it with other instruction? thanks.

 
You compare them just like that or if you want to insensitive to case,
if (Lcase(Var1)= Lcase(Var2)) then
do something
else
do anything
End if

Select Case strComp(var1,var2,1) ' 0=binary, 1 = text
Case -1 ' var 1 < var2
...
Case 0 ' var1 = var2
...
Case else ' var1 > var2
...
End Select

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top