case-insensitive

Case insensitive Charfield in django models

天大地大妈咪最大 提交于 2019-12-04 05:03:43
I am trying to achieve a category model where name has unique=True , but practically I can still add same category name with different cases. i.e. I have a category called Food I am still able to add food, FOOD, fOod, FOOd Is their any philosophy behind this? or it is a work in progress. Cause in real world if I think of Category Food, it will always be food, no matter what case it has used to mention itself. Thank you in advance to look at this. To answer my own question: I have found I can have clean method on my model. So I added class Category(models.Model): name = models.CharField(max

git merge: filter files to avoid silly conflicts (like whitespace or case changes)

拟墨画扇 提交于 2019-12-04 04:02:00
I'm currently inside a very complicated merge in git, and I have many conflicts. The conflict is about two Ada source files. I would like to make a merge that would ignore both whitespace changes and case changes (as the Ada language is case insensitive). Do you know if there is a way to tell git to ignore some kind of changes before a merge ? My solution is currently to run the GNAT pretty print on both branches before the merge, but if there was a common solution included in git, that would help me a lot. from the release notes of git 1.7.4: * The "recursive" strategy also learned to ignore

Are uppercase utf8 characters always the same number of bytes as their lowercase variants?

五迷三道 提交于 2019-12-04 03:40:38
Obviously it is true for the latin alphabet. But I'm asking this in a conceptual sense, across languages and the Unicode spec. Practically this came up for comparing two strings. If you already know they aren't the same number of bytes—across all languages—can you consider that enough of a guarantee that they are not differently "cased" versions of the same string? No. Consider U+0069 "i" which has the octet value 69 in UTF-8. In the uppercase form U+0130 "İ" this code point forms the UTF-8 sequence C4 B0 . Obligatory note: case is locale-sensitive. There is no principle or invariant in the

Difference of stricmp and _stricmp in Visual Studio?

若如初见. 提交于 2019-12-04 03:23:33
I may asking a stupid question, but I really can't find an answer with google plus I am still a beginner of using MSVS. I recently need to use functions to make comparison of two strings. What I don't understand is the difference of stricmp and _stricmp. They both can be used to compare strings and return the same results. I went to check them: char string1[] = "The quick brown dog jumps over the lazy fox"; char string2[] = "The QUICK brown dog jumps over the lazy fox"; void main( void ) { char tmp[20]; int result; /* Case sensitive */ printf( "Compare strings:\n\t%s\n\t%s\n\n", string1,

Case insensitive string comparison in Go

巧了我就是萌 提交于 2019-12-04 00:00:19
How do I compare strings in a case insensitive manner? For example, "Go" and "go" should be considered equal. https://golang.org/pkg/strings/#EqualFold is the function you are looking for. It is used like this (example from the linked documentation): package main import ( "fmt" "strings" ) func main() { fmt.Println(strings.EqualFold("Go", "go")) } 来源: https://stackoverflow.com/questions/30196780/case-insensitive-string-comparison-in-go

Case insensitive compare against bunch of strings

醉酒当歌 提交于 2019-12-03 20:37:10
What would be the best method to compare an NSString to a bunch of other strings case insensitive? If it is one of the strings then the method should return YES, otherwise NO. Here's a little helper function: BOOL isContainedIn(NSArray* bunchOfStrings, NSString* stringToCheck) { for (NSString* string in bunchOfStrings) { if ([string caseInsensitiveCompare:stringToCheck] == NSOrderedSame) return YES; } return NO; } Of course this could be greatly optimized for different use cases. If, for example, you make a lot of checks against a constant bunchOfStrings you could use an NSSet to hold lower

How do I ignore case when using startsWith and endsWith in Java? [duplicate]

≯℡__Kan透↙ 提交于 2019-12-03 20:34:23
问题 This question already has answers here : startsWith() method of string ignoring case (7 answers) Closed 2 years ago . Here's my code: public static void rightSel(Scanner scanner,char t) { /*if (!stopping)*/System.out.print(": "); if (scanner.hasNextLine()) { String orInput = scanner.nextLine; if (orInput.equalsIgnoreCase("help") { System.out.println("The following commands are available:"); System.out.println(" 'help' : displays this menu"); System.out.println(" 'stop' : stops the program");

Why underline is usually used in the sql table names rather than camel case [closed]

我是研究僧i 提交于 2019-12-03 13:27:21
问题 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 6 years ago . In all the applications/examples I have already seen(eg. wordpress). The column table names use underline rather than camel case. I'd

Rails validates_uniqueness_of across multiple columns with case insensitivity

扶醉桌前 提交于 2019-12-03 11:41:23
I have a model that has two fields, which I will call first_name and last_name, and I want to make sure that the combination of the two are case-insensitively unique. I've gotten halfway there by using this: validates_uniqueness_of :first_name, :scope => :last_name The problem is that the uniqueness check seems to be case sensitive, even though the documentation says it should be case insensitive by default. So given an existing record: { :first_name => 'John', :last_name => 'Smith' } This will be allowed: { :first_name => 'JOHN', :last_name => 'SMITH' } As well as any additional record where

Open a file case-insensitively in Ruby under Linux

删除回忆录丶 提交于 2019-12-03 10:50:19
Is there a way to open a file case-insensitively in Ruby under Linux? For example, given the string foo.txt , can I open the file FOO.txt ? One possible way would be reading all the filenames in the directory and manually search the list for the required file, but I'm looking for a more direct method. mikej Whilst you can't make open case insensitive you can write the directory search you suggested quite concisely. e.g. filename = Dir.glob('foo.txt', File::FNM_CASEFOLD).first if filename # use filename here else # no matching file end Note that whilst the documentation suggests that FNM