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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using && with strings?

Status
Not open for further replies.

MariusX1

Programmer
Dec 9, 2003
10
US
Is it possible to use an "and" (&&) with strings in an if statement?

I know that I can do it with integers:

if (a == 1) && (b == 2)
;do some stuff
endif

But, is it possible to do it with strings? Like:

if (strfind a "foo") && (strfind b "bar")
;do some other stuff
endif

I haven't been able to figure out the syntax...is it even possible? Thanks!!

Doug
 
Unfortunately I don't think there is a way to do that with strings, at least not one that I was able to think of after a couple minutes. I think the only option you have is to do nested if strfinds (you could do two separate strfinds and assign a 1 or 0 to two separate integer variables, then do a && comparison on those, but that wouldn't help much).


aspect@aspectscripting.com
 
Yes, I've thought of a couple work-arounds as well...I was just hoping that it was something I could do in one line. Thanks anyway!!

Doug
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top