contains

How do I check if a file is under a given directory, in PowerShell?

I want to check if a file path is in a given directory (or one of its subdirectories), from PowerShell. Right now I'm doing: $file.StartsWith( $directory, [StringComparison]::InvariantCultureIgnoreCase ) but I'm sure there are better ways. I could do take $file.Directory and iterate over all .Parents, but I was hoping for something...

C# modify List.Contains behavior

Hi, I have a List<MyObj> with the class MyObj : IComparable. I wrote the method CompareTo in the MyObj class per the IComparable interface, but when I use the List<MyObj>.Contains(myObjInstance) it returns false when it should be true. I'm not sure I'm understanding how I need to proceed to make sure the List uses my custom comparison...

Java String contain function?

from the following strings: "details.php?news=13&action=main&menu_type=&option=single&news_id=4792&pub_no=50" Is this possible in String str.contains(strcase) where strcase="details.php", "news_id" can both be checked at the same time. Not like: str.contains("details.php")&&str.contains("news_id"). both cases should be taken to t...

Javascript: Determine whether an array contains a value

i need to determine if a value exists in an array using javascript. I am using the following function: Array.prototype.contains = function(obj) { var i = this.length; while (i--) { if (this[i] == obj) { return true; } } return false; } The above function always returns false. The array val...

How to check if an element contains another element in jQuery

I am using xVal combind with the jquery.validate plugin, but have come across a slight problem in that it is posting validation messages twice in a certain instance. I think this bug should be fairly easily fixed with some clever jQuery in the placement of the error message. I am trying to find a way to see if a ul already contains an l...

Hibernate Criteria contains-in on an association to a table

Good day, I have a Hibernate mapping that looks something like this: <class name="MyEntity"> <set name="scalarSet" table="(select fk, scalar_value from other_table)"> <key column="fk"/> <property column="scalar_value" type="long"/> </set> </class Given this, how do I query such that a value of MyEntity.scalarSet (which is...

Is there a better way to write new List<string> {"a", "b"}.Contains(str) ?

I want to test whether a certain string is contained in a short list of strings. Currently the code is like this: if (new List<string> { "A", "B", "C" }.Contains (str)) { However, this seems bloated. For instance, iirc, in Java I could simply write {"A", "B", "C"}.Contains(str) which would be much preferable to the above. I'm sure th...

combine join with String.Contains in Linq query

i have the following linq query that create a left join between two tables: var joinResultRows = from leftTable in dataSet.Tables[leftTableName].AsEnumerable() join rightTable in dataSet.Tables[rightTableName].AsEnumerable() on...

containable on hasMany relationship

Greetings, I am trying to tear down query returned from find call using containable in CakePHP. for example I have 2 models, User and Post. User hasMany Post. Now when I am using containable on find call like so: $User->id = 1; $User->find('first', array( 'fields' => array('id'), 'contain' => array('Post') )) It will not re...

JQuery finding an element within Iframe (by its text) and adding .click function to it

Hello, I have a webpage (A) and I am embedding (A) to my mainpage (B) using iframe. This (A) contains a link which closes the browser window: <a href="" onclick="window.opener = window; window.close(); return false;">Close The Page</a> Since I embedd (A), the close ability in (A) is no more functional. What I need to do is, w...

How to find out if an element contains only a £ sign with JQuery?

Hi Guys, Say I have 2 divs: <div>&pound; 21.99</div> <div>&pound;</div> If I only want to select the div that contains the symbol only, how would I go about this? I have tried: if ($('div:contains("&pound;")').length > 0) { $(this).addClass("pound"); } ...

NHibernate: HasMany components and Where/Contains clause

Hi, I'm trying to work out how to create a query using Linq to NHibernate. I have two classes like this: public class Foo { private ISet<Bar> _bars = new HashedSet<Bar>(); public virtual ISet<Bar> Bars { get { return _bars; } set { _bars = value; } } } public class Bar { public string Name { get; se...

Is jquery ":contains" selector accepts this kind of value "Banking and Finance"?

Hello guys, I'm having problem with the contains in jquery. It seems that it only accepts one word. Not a phrase or two words. Example: $('#div:contains('Word')'); --> This is okay $('#div:contains('Just another word')'); --> This will return empty/this will not match. Have you experience this kind of problem? Your reply is greatl...

Contains() method of List<T>

Precisely which methods in a Class are responsible for the List<T>'s Contains() to operate? I have overloaded == in my class. But it seems to have no effect. ...

JQuery Contains Selector - Multiple Text Items

Hi, I am new to JQuery and maybe am missing the obvious, but how can I filter a table using the contains selector but have it look for multiple strings using an OR operator. In other words, I would like rows containing "Red" OR "Yellow" to be hidden. So far I have this which works by hiding all rows except the given date: $(function()...

Linq Correlated query // Contains

Edited Solution using or rather than union ! It seems there is a problem with linq2sql w.r.t selecting a relation post a UNION msdn's social forums also indicate it as so Intent To get WCtegories & WPBands having items ("W") and each item with either a price or an offer specified Sql just works fine but linq is bugging out with erro...

Entity Framework - Contains Method

Someone has an answer to this missing feature in Entity Framework. Does anyone have a solution to the missing Contains method in Entity Framework that works? I've tried a number of those on here and through Google, but none of them seem to actually work. ...

string.Contains with Linq To Sql return an Null exception

My Linq To Sql query PROJETS = PROJETS.Where(p => (p.VilleArrive != "" && p.VilleArrive != null) && p.VilleArrive.Contains(alerte.VilleArrive)); is translated like this SELECT * // (many columns) FROM [dbo].[cov_Projet] AS [t0] WHERE ([t0].[VilleArrive] <> @p0) // city != "" AND ([t0].[VilleArrive] IS NOT NULL) // city != nul...

STL: How to check that an element is in a std::set ?

How do you check that an element is in a set? Is there a simpler equivalent of the following code: myset.find(x) != myset.end() ...

PHP SimpleXML XPath contains() to find other elements referenced by this element

Hi Guys ang Gals, I'm being given XML in the following format, and am parsing it with PHP's SimpleXML. <?xml version="1.0" encoding="UTF-8"?> <ManageMyBooking> <BookingInfo> <PartyDetails> <Passenger> <PaxNo>1</PaxNo> <Title>Mrs</Title> <Surname>Murphy</Surname> ...