An operation is case insensitive when uppercase and lowercase characters are equally treated.
Questions tagged [case-insensitive]
1041 questions
85
votes
8 answers
Case-insensitive search and replace with sed
I'm trying to use SED to extract text from a log file. I can do a search-and-replace without too much trouble:
sed 's/foo/bar/' mylog.txt
However, I want to make the search case-insensitive. From what I've googled, it looks like appending i to the…
![](../../users/profiles/3488.webp)
Craig Walker
- 44,465
- 49
- 146
- 204
75
votes
6 answers
Case insensitive string comparison
I would like to compare two variables to see if they are the same, but I want this comparison to be case-insensitive.
For example, this would be case sensitive:
if($var1 == $var2){
...
}
But I want this to be case insensitive, how would I…
![](../../users/profiles/111731.webp)
Deniz Zoeteman
- 8,671
- 23
- 65
- 96
75
votes
3 answers
How to make String.Contains case insensitive?
How can I make the following case insensitive?
myString1.Contains("AbC")
![](../../users/profiles/327528.webp)
CJ7
- 20,640
- 59
- 173
- 305
74
votes
2 answers
c# Dictionary: making the Key case-insensitive through declarations
I have a Dictionary dictionary. It used to be Dictionary but other 'identifiers' have come into play and the Keys are now handled as strings.
The issue is that the Guid keys from my source data are coming as VarChar,…
![](../../users/profiles/91552.webp)
MoSlo
- 2,650
- 3
- 30
- 36
73
votes
6 answers
Case insensitive search in Mongo
I am using a case insensitive search in Mongo, something similar to https://stackoverflow.com/q/5500823/1028488.
ie I am using a regex with options i. But I am am having trouble restricting the regex to just that word, its performs more like a…
![](../../users/profiles/1028488.webp)
Praneeta
- 1,314
- 3
- 16
- 20
70
votes
10 answers
Case insensitive std::string.find()
I am using std::string's find() method to test if a string is a substring of another. Now I need case insensitive version of the same thing. For string comparison I can always turn to stricmp() but there doesn't seem to be a stristr().
I have found…
![](../../users/profiles/275449.webp)
wpfwannabe
- 13,908
- 13
- 70
- 125
70
votes
3 answers
Case insensitive argparse choices
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…
![](../../users/profiles/2838364.webp)
Peter
- 8,517
- 4
- 37
- 63
61
votes
8 answers
Is there a good way to have a Map get and put ignoring case?
Is there a good way to have a Map get and put ignoring case?
![](../../users/profiles/6013.webp)
Joshua
- 24,418
- 22
- 74
- 106
58
votes
6 answers
PostgreSQL: Case insensitive string comparison
Is there a simple ignore-case-comparison for PostgreSQL?
I want to replace:
SELECT id, user_name
FROM users
WHERE lower(email) IN (lower('adamB@a.com'), lower('eveA@b.com'));
With something like:
SELECT id, user_name
FROM users
…
![](../../users/profiles/51197.webp)
Adam Matan
- 107,447
- 124
- 346
- 512
54
votes
5 answers
How to do case-insensitive order in Rails with postgresql
I am in the process of switching my development environment from sqlite3 to postgresql 8.4 and have one last hurdle.
In my original I had the following line in a helper method;
result = Users.find(:all, :order => "name collate NOCASE")
which…
![](../../users/profiles/215895.webp)
brad
- 8,783
- 12
- 52
- 85
54
votes
7 answers
Case insensitive string replacement in JavaScript?
I need to highlight, case insensitively, given keywords in a JavaScript string.
For example:
highlight("foobar Foo bar FOO", "foo") should return "foobar Foo bar FOO"
I need the code to work for any keyword, and therefore…
Antti Sykäri
54
votes
7 answers
Case-insensitive string startswith in Python
Here is how I check whether mystring begins with some string:
>>> mystring.lower().startswith("he")
True
The problem is that mystring is very long (thousands of characters), so the lower() operation takes a lot of time.
QUESTION: Is there a more…
![](../../users/profiles/226958.webp)
Nicolas Raoul
- 55,003
- 52
- 197
- 338
52
votes
3 answers
Git: File Rename
I wanted to rename a folder from "Frameworks" to "frameworks", but git would not let me add the new lowercase name. I guess it treats filenames case insensitive, does it?
A git add frameworks/ -f didn't help
![](../../users/profiles/187676.webp)
Erik Aigner
- 28,109
- 21
- 129
- 187
52
votes
3 answers
PHP & Case Sensitivity
In PHP, variable and constant names are case sensitive, while function names are not.
As far as I am aware, PHP is the only language in which this happens. All other languages I have used are either totally case sensitive or totally case…
![](../../users/profiles/1413856.webp)
Manngo
- 8,349
- 6
- 50
- 74
51
votes
16 answers
Ignore case in Python strings
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…
![](../../users/profiles/6984.webp)
Paul Oyster
- 2,127
- 3
- 17
- 13