PDA

View Full Version : JScript contains


moiseszaragoza
10-12-2010, 05:13 PM
I was wondering how i can find if a string contains another str



<%@Language=JScript%>
<%
mypage = "/site1/index.asp"
if (mypage.Contains ("site1")){
Response.Write("site1")
}else{
Response.Write("other site ")
}

%>


Error

Microsoft JScript runtime error '800a01b6'

Object doesn't support this property or method

/app_new/test/page.asp, line 4

Old Pedant
10-12-2010, 06:52 PM
Look, JScript really *IS* JavaScript. Really. The differences are so tiny they don't matter.

So *ANY* good JavaScript reference can be used.

So look here:
http://www.codingforums.com/showthread.php?t=17254

There are so *MANY* ways to do the *equivalent* of contains.

search, match, indexOf, and then all the methods on regular expressions.