MongoDB and C#: Case insensitive search

The simplest and safest way to do that is using Linq: var names = namesCollection.AsQueryable().Where(name => name.FirstName.ToLower().Contains(“hamster”)); As explained in the tutorial ToLower, ToLowerInvariant, ToUpper and ToUpperInvariant all perform matches in a case insensitive way. After that you can use all the supported string methods like Contains or StartsWith. This example will generate: { “FirstName” … Read more

Case insensitive matching in Java switch-case statement

If you want to do that: just make sure the input data is in all lowercase, and use lowercase cases… switch (“UPPER”.toLowerCase()) { case “upper” : …. Localization issues Also, the ages old issue of localization strikes again, and plagues this thing too… For example, in the Turkish Locale, the uppercase counterpart of i is … Read more

Case insensitive search in Mongo

You can Use $options => i for case insensitive search. Giving some possible examples required for string match. Exact case insensitive string db.collection.find({name:{‘$regex’ : ‘^string$’, ‘$options’ : ‘i’}}) Contains string db.collection.find({name:{‘$regex’ : ‘string’, ‘$options’ : ‘i’}}) Start with string db.collection.find({name:{‘$regex’ : ‘^string’, ‘$options’ : ‘i’}}) End with string db.collection.find({name:{‘$regex’ : ‘string$’, ‘$options’ : ‘i’}}) Doesn’t … Read more

PostgreSQL: Case insensitive string comparison

select * where email ilike ‘[email protected]’ ilike is similar to like but case insensitive. For escape character use replace() where email ilike replace(replace(replace($1, ‘~’, ‘~~’), ‘%’, ‘~%’), ‘_’, ‘~_’) escape ‘~’ or you could create a function to escape text; for array of text use where email ilike any(array[‘[email protected]’, ‘[email protected]’])

How to change MySQL table names in Linux server to be case insensitive?

MySQL’s case sensitivity is by default handled by the file system, which is why you found this difference: 9.2.2. Identifier Case Sensitivity In MySQL, databases correspond to directories within the data directory. Each table within a database corresponds to at least one file within the database directory (and possibly more, depending on the storage engine). … Read more