How do I make jQuery Contains case insensitive, including jQuery 1.8+?

This is what i’m using in a current project, haven’t had any problems. See if you have better luck with this format: jQuery.expr[‘:’].Contains = function(a, i, m) { return jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase()) >= 0; }; In jQuery 1.8 the API for this changed, the jQuery 1.8+ version of this would be: jQuery.expr[“:”].Contains = jQuery.expr.createPseudo(function(arg) { return function( … Read more

How can I do a case insensitive string comparison?

This is not the best practice in .NET framework (4 & +) to check equality String.Compare(x.Username, (string)drUser[“Username”], StringComparison.OrdinalIgnoreCase) == 0 Use the following instead String.Equals(x.Username, (string)drUser[“Username”], StringComparison.OrdinalIgnoreCase) MSDN recommends: Use an overload of the String.Equals method to test whether two strings are equal. Use the String.Compare and String.CompareTo methods to sort strings, not to check … Read more

How do I do a case-insensitive string comparison?

Assuming ASCII strings: string1 = ‘Hello’ string2 = ‘hello’ if string1.lower() == string2.lower(): print(“The strings are the same (case insensitive)”) else: print(“The strings are NOT the same (case insensitive)”) As of Python 3.3, casefold() is a better alternative: string1 = ‘Hello’ string2 = ‘hello’ if string1.casefold() == string2.casefold(): print(“The strings are the same (case insensitive)”) … Read more

Are PostgreSQL column names case-sensitive?

Identifiers (including column names) that are not double-quoted are folded to lowercase in PostgreSQL. Column names that were created with double-quotes and thereby retained uppercase letters (and/or other syntax violations) have to be double-quoted for the rest of their life: “first_Name” Values (string literals / constants) are enclosed in single quotes: ‘xyz’ So, yes, PostgreSQL … Read more

Case insensitive ‘Contains(string)’

You could use the String.IndexOf Method and pass StringComparison.OrdinalIgnoreCase as the type of search to use: string title = “STRING”; bool contains = title.IndexOf(“string”, StringComparison.OrdinalIgnoreCase) >= 0; Even better is defining a new extension method for string: public static class StringExtensions { public static bool Contains(this string source, string toCheck, StringComparison comp) { return source?.IndexOf(toCheck, … Read more