[Javascript] Search for a substring in a string

innerlab.com info at innerlab.com
Sun Sep 14 21:16:34 CDT 2003


Forgive me if my questions are too basic.

I want to check for the existence of a substring within a string, more or
less like
the hypothetical syntax below :

var mystr = "these dogs are dirty"

if (mystr contains "dogs") {do stuff }

Of course, the operator "contains" is a phony one that
I made up.

I hope my quetion was clear enough.

I've seen the operator "in" in javascript reference docs,
but I didn't quite understand . Is it the right one?

Thanks in advance






More information about the Javascript mailing list