contain

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

北城以北 提交于 2020-08-19 11:23:36
问题 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 (((gewaesser_name1.includes("Stream") == "false") || (gewaesser_name1.includes("stream") == "false")) && ((gewaesser_name2.includes("Stream") == "false") || (gewaesser_name2.includes("stream") == "false"))) {var a= "..."} The code does obviously not work as the results are not

Read line containing String (Bash)

被刻印的时光 ゝ 提交于 2020-02-01 04:55:32
问题 I have a file, and its something like this: Device: name1 random text Device: name2 random text Device: name3 random text I have a variable: MainComputer What I want to get (for each name, i have like 40 names): MainComputer -> name1 MainComputer -> name2 MainComputer -> name3 What I have: var="MainComputer" var1=$(awk '/Device/ {print $3}' file) echo "$var -> $var1" This only gives the arrow "->" and the link for the first variable, I want them for the other 40 variables... Thanks anyway!

Free text search in sparql when you have multiword and scaping character

♀尐吖头ヾ 提交于 2020-01-16 19:47:09
问题 I am wondering how I can use in sparql query when I have a word like : Robert J. O'Neill I am looking for the resource that have the multiword unit with quota or unicode character in the Label property. SELECT DISTINCT ?resource ?abstract WHERE {?resource rdfs:label ?s. ?s <bif:contains> "'Robert J. O'Neill'" ?resource dbo:abstract ?abstract } ''' 回答1: Here is the query that will return all the elements that have "Robert J. O'Neill" as label. SELECT DISTINCT ?s WHERE { ?s rdfs:label ?label .

Using box model to contain items within its parent div

你。 提交于 2020-01-02 04:05:08
问题 Using the following HTML and CSS3 rules, I'm trying to make sure that the following criteria are adhered to: I have all of the criteria working except for item 1 where the children are exceeding their parent's width. Question: How to keep children within their parent? li items cannot exceed their parent width i.e. 400px img, label, and currency content must be centred vertically within their span currency should not wrap and should always be displayed in full currency should always be

Using box model to contain items within its parent div

大兔子大兔子 提交于 2020-01-02 04:05:05
问题 Using the following HTML and CSS3 rules, I'm trying to make sure that the following criteria are adhered to: I have all of the criteria working except for item 1 where the children are exceeding their parent's width. Question: How to keep children within their parent? li items cannot exceed their parent width i.e. 400px img, label, and currency content must be centred vertically within their span currency should not wrap and should always be displayed in full currency should always be

Downloading a website to a string

蓝咒 提交于 2019-12-29 07:43:08
问题 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 contains my school's schedule changes)). I've found out how to make the app check if the text in the EditText matches a string (with the method contains()), so now the only thing I need to do is to download all of the text of that website to a string.

CakePHP Conditions on deep model associations

我的梦境 提交于 2019-12-23 05:35:07
问题 Using CakePHP 1.3, I have a Find statement with a condition on the 3rd level deep association: Hotel > Room > RoomType > name I would like my Find statement to only return Hotels with RoomTypes that have the Name "Suite". I believe the following code should work, but it does not, stating an SQL syntax error: $this->Hotel->find('first', array( 'contain' => array('Room' => array('RoomType')), 'conditions' => array( 'Hotel.Room.RoomType.name' => 'Suite' ), )); Please note that a Hotel will have

Find contains class name in multiple classes

只愿长相守 提交于 2019-12-21 21:17:23
问题 I want to get the id in class like... <div class="main demo id_111 test"></div> <div class="main demo test id_222 test demo"></div> <div class="id_3 main demo test test demo"></div> Result must be 111 , 222 and 3 So I code like this var id = $(".main").attr("class"); var id = id.split("id_"); var id = id[1].split(" "); var id = id[0]; $("body").append(id); But someone know better coding than mine ? Playground : http://jsfiddle.net/UHyaD/ 回答1: You can use a regex : var id = $(".main").attr(

jquery: if url contains #work then do something

こ雲淡風輕ζ 提交于 2019-12-17 22:46:57
问题 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 doesnt work. Any suggestions? Any help is appreciated. 回答1: $(function() { if ( document.location.href.indexOf('#Work') > -1 ) { $('#elementID').animate({"left": "250"}, "slow"); } }); 回答2: window.location.href is pulling the URL into a variable, so you can't

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

戏子无情 提交于 2019-12-17 09:56:22
问题 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 code ArrayList<Hole> leftFlowInnerHole = new ArrayList<>(); //left holes rules leftFlowInnerHole.add(new Hole(0, 1)); leftFlowInnerHole.add(new Hole(1, 5)); leftFlowInnerHole.add(new Hole(5, 4)); leftFlowInnerHole.add(new Hole(0, 4)); when i add Hole userInputHole = new Hole(0