contains

How can my userscript get a link based on the link's text?

佐手、 提交于 2019-12-05 18:39:36
Given this HTML on the target page: <dd class="ddTit"> <a href="http://abc.xxx.com/54781.html" target="_blank">special text words</a> </dd> How can I get the url based on the " special text words ", and do the click in a Greasemonkey script? I tried this: var textlink = document.querySelector ("dd.ddTit a[textContent*='special']"); var clickEvent = document.createEvent ('MouseEvents'); clickEvent.initEvent ('click', true, true); textlink.dispatchEvent (clickEvent); with no luck. How do I select based on the textContent , such as textContent contains the word special ? Brock Adams Alas, you

Tell if string contains a-z chars [duplicate]

泪湿孤枕 提交于 2019-12-05 17:51:32
问题 This question already has answers here : How to check whether a string contains at least one alphabet in java? (2 answers) Closed 5 years ago . I very new to programming. I want to check if a string s contains a-z characters. I use: if(s.contains("a") || s.contains("b") || ... { } but is there any way for this to be done in shorter code? Thanks a lot 回答1: You can use regular expressions // to emulate contains, [a-z] will fail on more than one character, // so you must add .* on both sides. if

Java Crazyness - Contains fails when equals passes

核能气质少年 提交于 2019-12-05 16:42:16
This is the most crazy thing I have seen in java (1.6): Set<ActionPlan> actionPlans = assessment.getActionPlans(); //getActionPlans() returns a java.util.HashSet<ActionPlan> ActionPlan actionPlan = actionPlans.iterator().next(); assertTrue(actionPlan1.equals(actionPlan)); assertEquals(actionPlan1.hashCode(), actionPlan.hashCode()); assertTrue(actionPlans.contains(actionPlan1)); The first two asserts pass but the last one fails. I'm not giving you details on the ActionPlan and Assessment classes because it shouldn't matter. The contains method fails where the equals and hash don't. I'm not

Check if a string contains specific characters using VBS script

懵懂的女人 提交于 2019-12-05 13:19:52
My script is doing the following point : Retrieve all my selected folder files Class them by date (From the recent one to the older) Show them in a window Here is my VBS Script (I retrieve it here ): Option Explicit Const PathMDB = "C:\Users\C8461789\Desktop\test_script" MsgBox TriRepertoire,,"Enumération " & PathMDB '---lister les fichiers du répertoire --- Function TriRepertoire() Dim fso, fichier, fileItem Dim i, imax, z, valeur, cible, liste Set fso = CreateObject("Scripting.FileSystemObject") imax = 0 'début de l'énumération For Each fichier In fso.GetFolder(PathMDB).Files Set fileItem =

MySQL Spatial CONTAINS shows wrong result

六月ゝ 毕业季﹏ 提交于 2019-12-05 11:30:05
I have a strange behavior of MySQL spatial search. I have created a polygon in a GEOM field (Portugal bounds), then I am trying to find a point inside -- it is found ok. The next try is to find a point that is outside a polygon but the query still returns 1 found row. Please help, what am I doing wrong? Why does it find a point outside a polygon? SQL Code for testing is below: CREATE TABLE IF NOT EXISTS `test` ( `id` int(11) NOT NULL AUTO_INCREMENT, `bounds` geometry NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; INSERT INTO `test` (`id`, `bounds`) VALUES

VB.NET - If string contains “value1” or “value2”

别等时光非礼了梦想. 提交于 2019-12-05 11:21:50
问题 I'm wondering how I can check if a string contains either "value1" or "value2"? I tried this: If strMyString.Contains("Something") Then End if This works, but this doesn't: If strMyString.Contains("Something") or ("Something2") Then End if This gives me the error that conversion from string to Long can't be done. If I put the or ("Something2") inside the parenthesis of the first one, it gives me the error that the string cannot be converted to Boolean. So how can I check if the string

find image src that :contains?

两盒软妹~` 提交于 2019-12-05 08:37:51
问题 Morning all, I have a list of images like so: <ul id="preload" style="display:none;"> <li><img src="afx4000z-navy-icon-1_thumb.jpg"/></li> <li><img src="afx4000z-green-icon-1_thumb.jpg"/></li> </ul> Using jQuery how find all image src's within ul#preload that contain a specific string eg."green" something like... var new_src = jQuery('#preload img').attr('src')*** that contains green ***; 回答1: You need to use the *= selector: jQuery('#preload img[src*="green"]') If you want it to be case

Javascript Regular Expressions with jQuery Contains Regex Extension

此生再无相见时 提交于 2019-12-05 05:50:16
I'm using an extension for jQuery " contains ", shown below: $.extend($.expr[':'],{ containsExact: function(a,i,m){ return $.trim(a.innerHTML.toLowerCase()) === m[3].toLowerCase(); }, containsExactCase: function(a,i,m){ return $.trim(a.innerHTML) === m[3]; }, containsRegex: function(a,i,m){ var regreg = /^\/((?:\\\/|[^\/])+)\/([mig]{0,3})$/, reg = regreg.exec(m[3]); return RegExp(reg[1], reg[2]).test($.trim(a.innerHTML)); } }); I have a table with certain cells that I'm trying to format conditionally, so I'm using the extension in a td selector, with the containsRegex function. The problem

Any big difference between using contains or loop through a list?

▼魔方 西西 提交于 2019-12-05 04:09:44
Performance wise, is there really a big difference between using: ArrayList.contains(o) vs foreach|iterator LinkedList.contains(o) vs foreach|iterator Of course, for the foreach|iterator loops, I'll have to explicitly compare the methods and return true or false accordingly. The object I'm comparing is an object where equals() and hashcode() are both properly overridden. EDIT: Don't need to know about containsValue after all, sorry about that. And yes, I'm stupid... I realized how stupid my question was about containsKey vs foreach, nevermind about that, I don't know what I was thinking. I

Checking multiple contains on one string

断了今生、忘了曾经 提交于 2019-12-05 03:36:26
So I have a conditional that currently looks like this... if (input.Contains(",") || input.Contains("/") || input.Contains(@"\") || input.Contains(".")) I need to add a few more characters that I want to check for and was wondering if there's a more condensed syntax to accomplish the same thing? Something similar to SQL's IN operator? if ( input IN (",", "/", @"\", ....etc ) ) Anybody know of any cool tricks to accomplish this without adding lots of code? Consider using Regex (specify characters you want to check in brackets - remember that some of them must be escaped): Regex.IsMatch(input, @