+1 vote
594 views
in Programming by (530 points)
I am trying to verify that a string contains another sub string , Because I am using JavaScript so String.contains() method is not working in this case.
Please help me out on this. Thanks For your help! 

1 Answer

0 votes
by (2.8k points)
First of all i would like to let know about indexOf() its a method which returns index within the calling String ,When it does not found any value so it returns -1.
For more info of  indexOf()
 
See this code here: 
 
var s = "foo";
alert(s.indexOf("oo") > -1);
I hope you got my point.
 

Not a Member yet?

Ask to Folks Login

My Account

Your feedback is highly appreciated