case-insensitive

How to perform case insensitive diff in Git

走远了吗. 提交于 2019-11-27 17:16:04
问题 git diff does not support a case-insensitive comparison of files. Google shows a very few people asking for that feature, and that too only in combination with some other git diff switch, like with -G or with --color-words . I don't care for other switches, as long as git diff can show me the case-insensitive diff. Since I didn't see any specific question towards that, and since I found a solution after an hour researching this problem, I am adding this question and the answer. 回答1: The

Case insensitive argparse choices

 ̄綄美尐妖づ 提交于 2019-11-27 17:04:37
问题 Is it possible to check argparse choices in case-insensitive manner? import argparse choices = ["win64", "win32"] parser = argparse.ArgumentParser() parser.add_argument("-p", choices=choices) print(parser.parse_args(["-p", "Win32"])) results in: usage: choices.py [-h] [-p {win64,win32}] choices.py: error: argument -p: invalid choice: 'Win32' (choose from 'win64','win32') 回答1: Transform the argument into lowercase by using type = str.lower for the -p switch. This solution was pointed out by

PostgreSQL accent + case insensitive search

佐手、 提交于 2019-11-27 16:58:10
问题 I'm looking for a way to support with good performances case insensitive + accent insensitive search. Till now we had no issue on this using MSSql server, on Oracle we had to use OracleText , and now we need it on PostgreSQL. I've found this post about accent insensitive: Does PostgreSQL support "accent insensitive" collations? But we need to combine it with case insensitve. We also need to use indexes, otherwise performances could be impacted. Any real experience about the best approach for

Underscore.js Case Insensitive Sorting

ぐ巨炮叔叔 提交于 2019-11-27 15:59:14
Having some slight issues trying to get underscore.js to do case-insensitive sorting. I have an array of objects and would like to be able to sort by property name. Using shortcut method sortBy iteratee may also be the string name of the property to sort by (eg. length). Array to be sorted: var array = [{ name: 'test_1234', description: 'zzaaa bb cc'}, { name: 'zz1111', description: 'ZAAbbbcc'}, { name: 'TEST', description: '4422'}, { name: '1a2929', description: 'abcdef'}, { name: 'abc', description: 'Full description'}, { name: 'GGGGH', description: '123456'}]; Sorting using this method,

How to make this .htaccess rule case insensitive?

怎甘沉沦 提交于 2019-11-27 13:32:52
问题 This is a rule in my .htaccess # those CSV files are under the DOCROOT ... so let's hide 'em <FilesMatch "\.CSV$"> Order Allow,Deny Deny from all </FilesMatch> I've noticed however that if there is a file with a lowercase or mixed case extension of CSV, it will be ignored by the rule and displayed. How do I make this case insensitive? I hope it doesn't come down to "\.(?:CSV|csv)$" (which I'm not sure would even work, and doesn't cover all bases) Note: The files are under the docroot, and are

django-orm case-insensitive order by

妖精的绣舞 提交于 2019-11-27 12:38:50
I know, I can run a case insensitive search from DJango ORM. Like, User.objects.filter(first_name__contains="jake") User.objects.filter(first_name__contains="sulley") User.objects.filter(first_name__icontains="Jake") User.objects.filter(first_name__icontains="Sulley") And also, I can fetch them as user_list = User.objects.all().order_by("first_name") # sequence: (Jake, Sulley, jake, sulley) user_list = User.objects.all().order_by("-first_name") # for reverse # sequence: (sulley, jake, Sulley, Jake) Is there a direct way for a case-insensitive fetch?? As in I want a sequence as # desired

Ignore case in Python strings [duplicate]

≯℡__Kan透↙ 提交于 2019-11-27 09:46:22
问题 This question already has answers here : How do I do a case-insensitive string comparison? (11 answers) Closed 3 years ago . What is the easiest way to compare strings in Python, ignoring case? Of course one can do (str1.lower() <= str2.lower()), etc., but this created two additional temporary strings (with the obvious alloc/g-c overheads). I guess I'm looking for an equivalent to C's stricmp(). [Some more context requested, so I'll demonstrate with a trivial example:] Suppose you want to

Win32 File Name Comparison

独自空忆成欢 提交于 2019-11-27 08:25:45
Does anyone know what culture settings Win32 uses when dealing with case-insensitive files names? Is this something that varies based on the user's culture, or are the casing rules that Win32 uses culture invariant? Doug An approximate answer is at Comparing Unicode file names the right way . Basically, the recommendation is to uppercase both strings (using CharUpper , CharUpperBuff , or LCMapString ), then compare using a binary comparison (i.e. memcmp or wmemcmp, not CompareString with an invariant locale). The file system doesn't do Unicode normalization, and the case rules are not

How can I have case insensitive URLS in Spring MVC with annotated mappings

落爺英雄遲暮 提交于 2019-11-27 06:58:36
I have annotated mappings working great through my spring mvc web app, however, they are case sensitive. I cannot find a way to make them case insensitive. (I'd love to make this happen within Spring MVC, rather than redirecting traffic somehow) Spring 4.2 will support case-insensitive path matching. You can configure it as follows: @Configuration public class WebConfig extends WebMvcConfigurerAdapter { @Override public void configurePathMatch(PathMatchConfigurer configurer) { AntPathMatcher matcher = new AntPathMatcher(); matcher.setCaseSensitive(false); configurer.setPathMatcher(matcher); }

How can I make the map::find operation case insensitive?

僤鯓⒐⒋嵵緔 提交于 2019-11-27 06:37:14
Does the map::find method support case insensitive search? I have a map as follows: map<string, vector<string> > directory; and want the below search to ignore case: directory.find(search_string); It does not by default. You will have to provide a custom comparator as a third argument. Following snippet will help you... /************************************************************************/ /* Comparator for case-insensitive comparison in STL assos. containers */ /************************************************************************/ struct ci_less : std::binary_function<std::string, std