Questions tagged [contain]

214 questions
28
votes
7 answers

How can I correctly check if a string does NOT contain a specific word?

I am currently trying to figure out how to solve the above named problem. Specifically I want to check if the string does not contain the word "stream" both in capital and lowercase letters. Here's my code so far: if…
niccober
  • 343
  • 1
  • 3
  • 7
25
votes
6 answers

Calculate number of a letter in a string using Dart

I try to calculate how many letter "a" i have in the sentence: "Hello Jordania". I find the function contains. I using it like this: var phrase = "Hello Jordania; var comptenbrdea = phrase.contains('a'); print(comptenbrdea); I get "True" as…
Peter
  • 1,719
  • 4
  • 22
  • 31
23
votes
9 answers

Java check if two rectangles overlap at any point

I have multiple rectangles and one special rectangle: the selection rect. I want to check for each rectangle if the rectangle contains at least one point which is inside the selection rectangle. Here is an image for clarity:
user2190492
  • 1,174
  • 2
  • 9
  • 37
23
votes
5 answers

Ruby Hash check is subset?

How can I tell if if a Ruby hash is a subset of (or includes) another hash? For example: hash = {a: 1, b: 2, c: 3, d: 4, e: 5, f: 6, g: 7} hash.include_hash?({}) # true hash.include_hash?({f: 6, c: 3}) # true hash.include_hash?({f: 6, c:…
ma11hew28
  • 121,420
  • 116
  • 450
  • 651
21
votes
2 answers

jquery: if url contains #work then do something

I tried to write a script which allow me to load certain events when I enter specific url. My code looks like this: $(function(){ var url = window.location.pathname; $("url:contains('#Work')").animate({"left": "250"}, "slow"); }); But it…
Eddie
  • 255
  • 1
  • 3
  • 6
14
votes
2 answers

Order 'Contain' Model in CakePHP 3.x

I have multiple Things in AnotherThing now I am trying to order them in my edit action in my AnotherThing Controller - I can access the Things just fine in my edit, but I want to sort them differently (not over their ID), for example…
Isengo
  • 2,004
  • 3
  • 21
  • 43
14
votes
9 answers

Checking if string is only letters and spaces - Python

Trying to get python to return that a string contains ONLY alphabetic letters AND spaces string = input("Enter a string: ") if all(x.isalpha() and x.isspace() for x in string): print("Only alphabetical letters and spaces: yes") else: …
sithlorddahlia
  • 157
  • 1
  • 1
  • 11
11
votes
4 answers

Java ArrayList Contain always return false although it contain the same value

This is my Hole Class class Hole { public int a; public int b; Hole(int a, int b) { this.a = a; this.b = b; } So i adding an ArrayList that contain several several hole public void checkPathLoop(int x, int y) { //rough…
Shan Markus
  • 127
  • 1
  • 2
  • 12
10
votes
4 answers

check chars in varchar

How can I check that varchar contains all chars from another varchar, where sequence of characters is irrelevant? For example: I have varchar @a = 'ABC' and column 'Col' in table 'Table' where is row with 'Col' = 'CBAD'. I want to select this row,…
9
votes
2 answers

Does F# has a function to tell if a list contains a specific value?

Haskell has "elem" predicate to tell like: Prelude> 5 `elem` [2,4..10] False In F#, how to conveniently tell whether a value is in a list, or array, or seq or map, or dictionary?
vik santata
  • 2,989
  • 8
  • 30
  • 52
7
votes
2 answers

Java geotools check if point is contained in polygon with tolerance

I am using Java Geotools library for check if a POINT(...) is contained in a POLYGON(...). I have done it with: Geometry sPG = reader.read(wktStartPoint); //startpointgeometry Geometry sEG = reader.read(wktEndPoint); if(wktLayerGeo.contains(sPG) ||…
michele
  • 26,348
  • 30
  • 111
  • 168
7
votes
2 answers

Downloading a website to a string

Having done some basic tutorials, I started making my first real android app in eclipse. I want this app to check if the text in an EditText matches the text on a website (this one: http://www.augustinianum.eu/roosterwijzigingen/14062012.pdf (it…
Xander
  • 5,487
  • 14
  • 49
  • 77
6
votes
4 answers

Fastest way to check does string contain any word from list

I have Python application. There is list of 450 prohibited phrases. There is message got from user. I want to check, does this message contain any of this prohibited pharases. What is the fastest way to do that? Currently I have this code: message…
TN888
  • 7,659
  • 9
  • 48
  • 84
6
votes
2 answers

Fluid width container to hug floats

I have a container (image gallery) that is max-width:80%. Inside, images are floated left forming columns and rows. As you shrink/expand the browser window, more or fewer images fit into each row and there is typically a "remainder" at the end of…
Vlad
  • 612
  • 1
  • 7
  • 13
5
votes
2 answers

AppleScript "if contain"

I have a script which look for the name and search for a match with a another variable. It's working fine however if the variable 1 is "Name Demo" and variable 2 is "Demo Name" then the script don't find a match. set nameMatchTXT to "" if…
Kevin
  • 1,076
  • 4
  • 22
  • 49
1
2 3
14 15