Questions tagged [case-insensitive]

An operation is case insensitive when uppercase and lowercase characters are equally treated.

1146 questions
248
votes
5 answers

Are PostgreSQL column names case-sensitive?

I have a db table say, persons in Postgres handed down by another team that has a column name say, "first_Name". Now am trying to use PG commander to query this table on this column-name. select * from persons where first_Name="xyz"; And it just…
5122014009
  • 3,766
  • 6
  • 24
  • 34
240
votes
10 answers

Case insensitive replace

What's the easiest way to do a case-insensitive string replacement in Python?
Adam Ernst
  • 52,440
  • 18
  • 59
  • 71
237
votes
21 answers

Case-insensitive search in Rails model

My product model contains some items Product.first => # I'm now importing some product parameters from another dataset, but there are inconsistencies in the spelling of the names. For instance, in the other…
Jesper Rønn-Jensen
  • 106,591
  • 44
  • 118
  • 155
215
votes
8 answers

Case-Insensitive List Search

I have a list testList that contains a bunch of strings. I would like to add a new string into the testList only if it doesn't already exist in the list. Therefore, I need to do a case-insensitive search of the list and make it efficient. I can't…
Brap
  • 2,647
  • 2
  • 19
  • 15
214
votes
9 answers

case-insensitive list sorting, without lowercasing the result?

I have a list of strings like this: ['Aden', 'abel'] I want to sort the items, case-insensitive. So I want to get: ['abel', 'Aden'] But I get the opposite with sorted() or list.sort(), because uppercase appears before lowercase. How can I ignore…
user975135
210
votes
12 answers

Case insensitive 'in'

I love using the expression if 'MICHAEL89' in USERNAMES: ... where USERNAMES is a list. Is there any way to match items with case insensitivity or do I need to use a custom method? Just wondering if there is a need to write extra code for…
RadiantHex
  • 24,907
  • 47
  • 148
  • 244
209
votes
14 answers

Case insensitive string as HashMap key

I would like to use case insensitive string as a HashMap key for the following reasons. During initialization, my program creates HashMap with user defined String While processing an event (network traffic in my case), I might received String in a…
s.r
  • 2,507
  • 3
  • 22
  • 32
205
votes
14 answers

Case insensitive comparison of strings in shell script

The == operator is used to compare two strings in shell script. However, I want to compare two strings ignoring case, how can it be done? Is there any standard command for this?
Sachin
  • 20,805
  • 32
  • 86
  • 99
192
votes
9 answers

SQL- Ignore case while searching for a string

I have the following data in a Table PriceOrderShipped PriceOrderShippedInbound PriceOrderShippedOutbound In SQL I need to write a query which searches for a string in a table. While searching for a string it should ignore case. For the below…
shockwave
  • 3,074
  • 9
  • 35
  • 60
191
votes
5 answers

String contains - ignore case

Is it possible to determine if a String str1="ABCDEFGHIJKLMNOP" contains a string pattern strptrn="gHi"? I wanted to know if that's possible when the characters are case insensitive. If so, how?
AlwaysALearner
  • 6,320
  • 15
  • 44
  • 59
178
votes
13 answers

Is there a C# case insensitive equals operator?

I know that the following is case sensitive: if (StringA == StringB) { So is there an operator which will compare two strings in an insensitive manner?
GateKiller
  • 74,180
  • 73
  • 171
  • 204
161
votes
10 answers

How to replace case-insensitive literal substrings in Java

Using the method replace(CharSequence target, CharSequence replacement) in String, how can I make the target case-insensitive? For example, the way it works right now: String target = "FooBar"; target.replace("Foo", "") // would return "Bar" String…
J. Lin
  • 2,259
  • 5
  • 20
  • 17
146
votes
6 answers

Case Insensitive Flask-SQLAlchemy Query

I'm using Flask-SQLAlchemy to query from a database of users; however, while user = models.User.query.filter_by(username="ganye").first() will return doing user =…
Ganye
  • 2,481
  • 3
  • 16
  • 13
127
votes
13 answers

Is VB really case insensitive?

I'm not trying to start an argument here, but for whatever reason, it's typically stated that Visual Basic is case insensitive and C languages aren't (and somehow that is a good thing). But here's my question: Where exactly is Visual Basic case…
Todd Main
  • 28,951
  • 11
  • 82
  • 146
118
votes
12 answers

How do I make my string comparison case-insensitive?

I created a Java program to compare two strings: String str = "Hello"; if (str.equals("hello")) { System.out.println("match"); } else { System.out.println("no match"); } It's case-sensitive. How can I change it so that it's not?
user268018
  • 1,245
  • 2
  • 9
  • 7
1
2
3
76 77