views:

191

answers:

3

Given a string A, how can I determine if that string contains the substring "video/x-flv"?

+2  A: 
A.indexOf("video/x-flv") >= 0
spender
Please don't jam your operators together with your operands without whitespace like this. `A.indexOf("video/x-flv") >= 0` is significantly more readable (and fits the style guidelines).
Cory Petosky
OK. So used to the IDE doing for me that I've become lazy ;)
spender
A: 

http://www.gskinner.com/blog/archives/2007/04/free_extension.html

gSkinner hasText() function

EDIT:

NO Sorry - contains()

Glycerine
A: 

if(myString.indexof("A",0)>0)

invertedSpear
That's quite incorrect. It might still work sometimes, but who'd want something that works only sometimes?
bug-a-lot
the only thing I see wrong with it is that I forgot the `>=` and just did a `>`. What else is wrong about it? Would be much more effective criticism if you explained why you think it's wrong rather than just claiming that it is. Thanks
invertedSpear