Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determine if a string contains a specific substring

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

like image 771
Rella Avatar asked Apr 29 '10 00:04

Rella


People also ask

How do you check if a string contains a specific substring?

You can use contains(), indexOf() and lastIndexOf() method to check if one String contains another String in Java or not. If a String contains another String then it's known as a substring. The indexOf() method accepts a String and returns the starting position of the string if it exists, otherwise, it will return -1.

How do I check if a string contains a specific character?

Use the String. includes() method to check if a string contains a character, e.g. if (str. includes(char)) {} . The include() method will return true if the string contains the provided character, otherwise false is returned.

How do I check if a string contains?

The includes() method returns true if a string contains a specified string. Otherwise it returns false .

How do you check whether a string contains a substring in pandas?

Using “contains” to Find a Substring in a Pandas DataFrame The contains method returns boolean values for the Series with True for if the original Series value contains the substring and False if not. A basic application of contains should look like Series. str. contains("substring") .


1 Answers

A.indexOf("video/x-flv") >= 0
like image 113
spender Avatar answered Oct 11 '22 00:10

spender