case-insensitive

How do I remove an element from an array in a case-insensitive way?

时光毁灭记忆、已成空白 提交于 2019-12-12 03:52:17
问题 I’m suing Ruby 2.3. When I want to remove a string element from an array by value, I can do 2.3.0 :005 > a.delete("AB") => "AB" but how do I remove the element in a case-insensitive way? That is, how can I make a.delete(“ab”) behave like a.delete(“AB”) ? 回答1: Try delete_if a.delete_if { |s| s.downcase == 'ab' } 回答2: Your question says "remove an element" which implies you only want to remove one element when duplicates exist. If that is your intent (and there may be duplicates), you can

Case-insensitive user-names in Symfony2

半世苍凉 提交于 2019-12-11 13:59:49
问题 By default, Symfony2 matches usernames case-sensitively. I want users to be able to enter johnsmith , JohnSmith , johnSMITH , or any variant of that, and have them all register as johnsmith . How do I do this? I though the easiest way would be to always convert each username to lower-case before comparing them. This is easy to do on the one side (just throw a lower() into the SQL statement), but how do I do that for what the user types in in the login form? Since Symfony automatically takes

Can I make Entity Framework use sqlite's LIKE instead of instr()?

谁都会走 提交于 2019-12-11 09:45:56
问题 Currently using .NET Core 2. I use a LINQ query similar to: var peopleInRoseStreet = context.Person .Include(p => p.Addresses) .Where(p => p.Addresses.Any(a => a.Text.Contains("rose"))); EF seems to translate this to: SELECT "p".* FROM "Person" AS "p" WHERE EXISTS ( SELECT 1 FROM "PersonAddress" AS "a" WHERE (instr("a"."Text", 'rose') > 0) AND ("p"."Id" = "a"."person_id")) ORDER BY "p"."Id" By using instr() , the comparison is case-sensitive although the PersonAddress.Text column is set to

::std::regex_replace with syntax flag icase on Windows (VS2013 Update 4, VS2015 Update 3) does not match using character ranges

旧时模样 提交于 2019-12-11 06:57:52
问题 I use the following C++ code with VS2013 Update 4 and VS2015 Update 3 using a character range to try to match case insensitively and to replace the occurrences: std::wstring strSource(L"Hallo Welt, HALLO WELT"); std::wstring strReplace(L"ello"); std::regex_constants::syntax_option_type nReFlags = std::regex::ECMAScript | std::regex::optimize | std::regex::icase; std::wregex re(L"[A]LLO", nReFlags); std::wstring strResult = std::regex_replace(strSource, re, strReplace); wcout << L"Source: \""

r %in% operator | control case sensitivity [duplicate]

我是研究僧i 提交于 2019-12-11 06:21:55
问题 This question already has answers here : Case-insensitive search of a list in R (6 answers) Closed 3 years ago . Is there a way to control the case sensitivity of the %in% operator? In my case I want it to return true no matter the case of the input: stringList <- c("hello", "world") "Hello" %in% stringList "helLo" %in% stringList "hello" %in% stringList Consider this code as a reproducible example, however in my real application I am also using a list of strings on the left and check for the

A case insensitive string class in python

百般思念 提交于 2019-12-11 06:03:01
问题 I need to perform case insensitive string comparisons in python in sets and dictionary keys. Now, to create sets and dict subclasses that are case insensitive proves surprisingly tricky (see: Case insensitive dictionary for ideas, note they all use lower - hey there's even a rejected PEP, albeit its scope is a bit broader). So I went with creating a case insensitive string class (leveraging this answer by @AlexMartelli): class CIstr(unicode): """Case insensitive with respect to hashes and

What's the advantage of case sensitive languages over case insensitive ones? [closed]

隐身守侯 提交于 2019-12-10 23:40:00
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 9 years ago . I have been doing a number of projects in Delphi, which uses the case insensitive language Pascal, and I was wondering what the

Saving and/or Querying User Display Names in Firebase using caseInSensitive?

僤鯓⒐⒋嵵緔 提交于 2019-12-10 18:27:43
问题 I'm moving my project over to Firebase from Swift. Firebase user's don't have usernames but I'm allowing them to save a display name which works more like a attribute than an actual object. How can I get users to query for other users/"friends" using case in sensitive text? 回答1: You can easily accomplish this task. We don't know how your current data is structured but here's an example users user_id_0 dsplay_name: "Smokey" lower_case_name: "smokey" user_id_1 display_name: "Bandit" lower_case

setq of case-sensitivity in .emacs has no effect

坚强是说给别人听的谎言 提交于 2019-12-10 15:05:58
问题 I have a lot of custom stuff in my .emacs file: fonts, colors, window sizing, key bindings, etc. All of it works. Then at the end, I just added a: (setq case-fold-search nil) . It's a variable that when set to nil is supposed to make search case-sensitive in all emacs modes. It doesn't for me. Setting case-fold-search to nil in an individual buffer works, but when I set it in .emacs , it doesn't work. Is there a reason why a setq declaration in a .emacs may not work sometimes? How should I

Insert item into case-insensitive sorted list in Python

不问归期 提交于 2019-12-10 13:18:33
问题 I have a list of strings that is already sorted in case-insensitive order. I would like to insert a new string into the list. One way to do this is to append the item and then sort the list, like so: myList.append('Something') myList.sort(key=lambda s: s.lower()) But I was wondering if there is a way to just insert the item in the correct position without sorting the whole thing again. I found this question: Insert an item into a sorted list in Python. It points towards Python's bisect module