contains

How can i search a non case sensitive word with Sql Server XQuery?

I'm using an Xml field in my Sql Server database table. I'm trying to search a word using the XQuery contains method but it seems to search only in case sensitive mode. The lower method isn't implemented on Sql Server XQuery implementation also. ¿Is there a simple solution to this problem? ...

How do I use LINQ Contains(string[]) instead of Contains(string)

Hey all. I got one big question. I got a linq query to put it simply looks like this: from xx in table where xx.uid.ToString().Contains(string[]) select xx The values of the string[] array would be numbers like (1,45,20,10,etc...) the Default for .Contains is .Contains(string). I need it to do this instead: .Contains(string[])......

Finding numerical substrings mathematically, without string comparison.

This originally was a problem I ran into at work, but is now something I'm just trying to solve for my own curiosity. I want to find out if int 'a' contains the int 'b' in the most efficient way possible. I wrote some code, but it seems no matter what I write, parsing it into a string and then using indexOf is twice as fast as doing it...

Nested LINQ query using Contains with a bigint

This is the SQL I want (ClearinghouseKey is a bigint): select * from ConsOutput O where O.ClearinghouseKey IN ( select distinct P.clearinghouseKey from Project P Inner join LandUseInProject L on L.ClearinghouseKey = P.ClearinghouseKey where P.ProjectLocationKey IN ('L101', 'L102', 'L103') and L.LandUseKey IN ('U000', 'U001', '...

Spring context.xml and Set.contains()

Spring: In my context.xml, I have: <util:set id="someIDs" set-class="java.util.HashSet" value-type="java.lang.String"> <value>"W000000001"</value> <value>"W000000003"</value> <value>"W000000009"</value> </util:set> In my Java bean, the implementation is: private Set<String> someSet = ComUtiliti...

Case insensitive contains(string)

Is there a way to make the following return true? string title = "ASTRINGTOTEST"; title.Contains("string"); There doesn't seem to be an overload that allows me to set the case sensitivity.. Currently I UPPERCASE them both, but that's just silly. UPDATE The sillyness I refer to is the i18n issues that come with up- and down casing. ...

LINQ to SQL query fails using two Contains statements

I have two tables, DH_MASTER and DH_ALIAS. DH_MASTER contains information about a person, including their name. DH_ALIAS contains AKA records about the person. The tables are linked by the Operator field which is a primary key in DH_MASTER. The users want to search by the name stored in DH_MASTER as well as search through all of thei...

HQL "Contains" statement howto?

Hi, I have an entity that has a string property called Tags. I would like to query this entity based upon if a certain string is located in Tags property. So for example, I would have a function IList GetEntityByTag(string tag), this would return all Entity's that have the value of tag in their 'Tags' property. I tried going through t...

Compare objects in LinkedList.contains()

I want to be able to have LinkedList.contains() return true for a custom comparator. Suppose that I have 1 LinkedList and 2 objects LinkedList<MyObject> myList = new LinkedList<MyObject>(); MyObject a = new MyObject("HELLO"); MyObject b = new MyObject("HELLO"); Technicaly, both objects are identical in terms of comparison (MyObject ...

HQL Equivalent of SQL Contains

I'm trying to write an HQL query to select objects which contain an object in a child collection. Example: Contest Object ContestID ContestName RequiredCountries -> one to many collection of Country objects Country Object CountryCode CountryName The sql equivalent of what i want: SELECT * FROM CONTEST C WHERE C.CONTESTID IN(SELE...

VB.NET List(of X).Contains Behavior

I have a custom class set up as a key that has two properties, X and Y I have something similar to this: Dim test As New List(of TestClass) Dim key as New TestData key._a = A key._b = B For Each a As TestClass In SomeCollection If Not test.Contains(key) Then 'Do Stuff End If Next My question is this: How does the .Contain...

Faster way to do a List<T>.Contains()

I am trying to do what I think is a "de-intersect" (I'm not sure what the proper name is, but that's what Tim Sweeney of EpicGames called it in the old UnrealEd) // foo and bar have some identical elements (given a case-insensitive match) List‹string› foo = GetFoo(); List‹string› bar = GetBar(); // remove non matches foo = foo.Where(x ...

Is it possible to automatically handle List.Contains by comparing a property on the item?

Can we do something similar to List.Contains(myItem) in order to check if a property on an item in the list equals a property on myItem. (We have considered Contains and Exists, something like: if (orderLines.Contains(myLine)) { ... } but cannot get a simple expression.) We would like something as simple as the following: if (ord...

Entlib Cache.Contains NULL problem

Hi, I have a combined authorization and menustructure system on our backend. For performance reasons EntLib caching is used in the frontend client (MVC rel 1.0 website, IIS 5.1 local, IIS 6.0 server, no cluster). Sometimes 'Cache.Contains' will return true, but the contents of the cache is NULL. I know for certain that I filled it corr...

Return surrounding text for phrase found in full-text search, SQL 2005

I'm using a contains predicate to find phrases in a SQL Server indexed text field. Is there a way to return the portion of the text field that contains the searched phrase, or some area around it? For example, if I'm searching for "all men are created equal" in the Gettysburg address (excerpted below), I'd like to return "dedicated to ...

django foreignkey contains query

I have the following model class Command(models.Model): server = models.ForeignKey(Server) user_login = models.CharField(max_length=100) user_run = models.CharField(max_length=100) host = models.CharField(max_length=100) ip = models.CharField(max_length=100) session = models.CharField(max_length=100) command ...

Compiled queries and "Parameters cannot be sequences"

I thought that compiled queries would perform the same query translation as DataContext. Yet I'm getting a run-time error when I try to use a query with a .Contains method call. Where have I gone wrong? //private member which holds a compiled query. Func<DataAccess.DataClasses1DataContext, List<int>, List<DataAccess.TestRecord>> com...

Stack overflow in LINQ to SQL and the Contains keyword

I have an Extension method which is supposed to filter a Queryable object (IQueryable) based upon a collection of Ids.... Note that IQueryable is sourced from my database via a LinqToSql request public static IQueryable<NewsItemSummary> WithID(this IQueryable<NewsItemSummary> qry, IQueryable<Guid> Ids) { return from newsIt...

CONTAINS operator using '@'

Hey guys, I am trying to use the Contains operator. It works fine with test data eg. WHERE CONTAINS(file,'"*ash*"') However, I want to get the keyword from a TextBox using something like CONTAINS(file,'"*@key*"'), but this doesnt seem to work. Any suggestions please. Thanks ...

Best way to use contains in an ArrayList in Java?

Hello I have an ArrayList in Java which is made up of a type containing two strings and an integer. I can successfully test if one element of this ArrayList equals another but I find that the contains method fails. I believe this is due to the fact that my type is not primitive. Now I see two alternatives to this and I wonder which is ...