Top "Substring" questions

Part of a string, or the function/method that returns part of a string

How to check whether a string contains a substring in JavaScript?

Usually I would expect a String.contains() method, but there doesn't seem to be one. What is a reasonable way …

javascript string substring string-matching
How do I check if a string contains a specific word?

Consider: $a = 'How are you?'; if ($a contains 'are') echo 'true'; Suppose I have the code above, what is …

php string substring contains string-matching
Does Python have a string 'contains' substring method?

I'm looking for a string.contains or string.indexof method in Python. I want to do: if not somestring.contains("…

python string substring contains
How do I get a substring of a string in Python?

Is there a way to substring a string in Python, to get a new string from the third character to …

python string substring
How to check if a string contains a substring in Bash

I have a string in Bash: string="My string" How can I test if it contains another string? if [ $string ?? …

string bash shell substring sh
How do I check if string contains substring?

I have a shopping cart that displays product options in a dropdown menu and if they select "yes", I want …

javascript jquery string substring contains
Extract substring in Bash

Given a filename in the form someletters_12345_moreleters.ext, I want to extract the 5 digits and put them into a …

string bash shell substring
In Java, how do I check if a string contains a substring (ignoring case)?

I have two Strings, str1 and str2. How do I check if str2 is contained within str1, ignoring case?

java string substring
Check if a string contains a string in C++

I have a variable of type std::string. I want to check if it contains a certain std::string. How …

c++ string substring
How to extract the substring between two markers?

Let's say I have a string 'gfgfdAAA1234ZZZuijjk' and I want to extract just the '1234' part. I only …

python string substring