Questions tagged [contains]

The "contains" operator/method is used to determine if an entity collection contains an element with a particular property.

The contains operator/method is used to determine whether one (or more) of the entities in an entity collection has a particular property.

3008 questions
37
votes
1 answer

jQuery :contains(regex)?

Is it possible to have a jQuery selector where the :contains() is a regular expression? I need to select an element where the innerHTML contains something findable through regex? I know it's a short question. My apologies. var t = $("#id…
Edge
  • 2,456
  • 6
  • 32
  • 57
36
votes
3 answers

IEnumerable.Contains with predicate

I need just to clarify that given collection contains an element. I can do that via collection.Count(foo => foo.Bar == "Bar") > 0) but it will do the unnecessary job - iterate the whole collection while I need to stop on the first occurrence. But I…
abatishchev
  • 98,240
  • 88
  • 296
  • 433
35
votes
3 answers

.Contains() method not calling Overridden equals method

I am having an issue where I make an ArrayList of Foo objects, I override the equals method, and I cannot get the contains method to call the equals method. I have tried overriding equals and hashcode together, but it still doesn't work. I'm sure…
Reid Mac
  • 2,411
  • 6
  • 37
  • 64
34
votes
4 answers

JQuery, selecting what does NOT contains something

If i want to select what contains "pc" i use $('tr:contains("pc")') But what can i use to select what does NOT contains "pc"?
Mewster
  • 1,057
  • 3
  • 11
  • 21
33
votes
2 answers

find image src that :contains?

Morning all, I have a list of images like so: Using jQuery how find all image src's within…
Charles Web Dev
  • 429
  • 2
  • 7
  • 12
32
votes
5 answers

Find if an element with a specific property value is found in a list

I'm trying to find a value in a list of objects in kotlin, using for it "filter", but I need to return true or false if the value is found, but filter returns me a list of object in the case of match. t.filter { it.retailerId == value } ¿How I can…
Víctor Martín
  • 3,352
  • 7
  • 48
  • 94
31
votes
2 answers

Syntax error near 'of' in the full-text search condition 'control of'

I have the following WHERE clause: WHERE (@Keywords IS NULL OR (CONTAINS((p.Title, p.Area, p.[Message]), @Keywords)) ) If @Keywords = 'control', then the query executes successfully and filters my records If @Keywords = 'control…
Curtis
  • 101,612
  • 66
  • 270
  • 352
31
votes
9 answers

How to check if a string contains an int? -Swift

I need to know if a string contains an Int to be sure that a name the user entered is a valid full name, for that I need to either make the user type only chars, or valid that there are no ints in the string the user entered. Thanks for all the…
arbel03
  • 1,217
  • 2
  • 14
  • 24
30
votes
6 answers

Finding out if a list of Objects contains something with a specified field value?

I have a list of DTO received from a DB, and they have an ID. I want to ensure that my list contains an object with a specified ID. Apparently creating an object with expected fields in this case won't help because contains() calls for…
Sergey
  • 2,880
  • 3
  • 19
  • 29
29
votes
2 answers

XPath expression to find elements whose tag name contains 'Name'

I am a newcomer to XPath. I am looking for a way to get all elements whose tag name contains a particular string. For example, if I have XML like below, I want to get all the elements whose tag name contains the word 'Name'. i.e., I want to fetch…
user2082317
  • 303
  • 1
  • 3
  • 6
28
votes
4 answers

Test if string contains anything from an array of strings (kotlin)

I'm new to Kotlin (I have a Java background) and I can't seem to figure out how to check whether a string contains a match from a list of keywords. What I want to do is check if a string contains a match from an array of keywords (case-insensitive…
takanuva15
  • 1,286
  • 1
  • 15
  • 27
28
votes
6 answers

Conditional If Statement: If value in row contains string ... set another column equal to string

EDIT MADE: I have the 'Activity' column filled with strings and I want to derive the values in the 'Activity_2' column using an if statement. So Activity_2 shows the desired result. Essentially I want to call out what type of activity is…
PineNuts0
  • 4,740
  • 21
  • 67
  • 112
28
votes
7 answers

Better way to detect if a string contains multiple words

I am trying to create a program that detects if multiple words are in a string as fast as possible, and if so, executes a behavior. Preferably, I would like it to detect the order of these words too but only if this can be done fast. So far, this is…
Silver
  • 421
  • 2
  • 8
  • 17
28
votes
4 answers

check if value already exists

I have dictionary which holds my books: Dictionary books Book definiton: class book { string author { get; set; } string title { get; set; } } I have added some books to the dictionary. How can I check if there is a book…
Bublik
  • 912
  • 5
  • 15
  • 30
27
votes
1 answer

Checking if array is contained in another array in PostgreSQL

There is an array[10,20] and I want to know if it is a subset of array[20,30,10] or not. Is there a postgresql function or operation to determine if one array contains another? Desired outcomes: [10,20] and [30,20,10] - true [10,20] and [10,30] -…
edem
  • 3,222
  • 3
  • 19
  • 45