VBScript to compare more than 2 strings
String1 ="text"
String2 ="text"
String3 ="text"
String4 ="text"
String5 ="text"
if String1 and String2 and string3 and string4 and string5 = "text" then
msgbox "equal"
else
msgbox "not equal"
end if
The above syntax does not work well. do you have any other way to compare multiple strings?
0 Comments
[ + ] Show comments
Answers (3)
Answer Summary:
Please log in to answer
Posted by:
shreyas
10 years ago
Hi
to compare multiple string :-
take an array
a=Array("text","text","text","text","monday","sunday")
b=Filter(a,"")
for each x in b
if strcomp(x,"test",vbTextCompare) = 0 then
msgbox "Equal"
else
Msgbox "Not equal"
End if
Next
hope this help..
Comments:
-
This syntax worked.. Thanks a lot :) - Hariharan 10 years ago
Posted by:
StockTrader
10 years ago
Posted by:
SilentKiller
10 years ago
you can use StrComp function in VBScript
Comments:
-
StrComp function works only to compare 2 strings. - Hariharan 10 years ago