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 trivi...
Hi everybody,
I'm trying to get a case-insensitive Search with two String in JavaScript working.
Normally it would be like this:
var string="Stackoverflow is the BEST";
var result= string.search(/best/i);
alert(result);
The /i flag would be for case-insensitive.
But I need to search for a second string, without the flag it works per...
Is there a good way to have a Map get and put ignore case?
...
I need to highlight, case insensitively, given keywords in a JavaScript string.
For example:
highlight("foobar Foo bar FOO", "foo") should return "<b>foo</b>bar <b>Foo</b> bar <b>FOO</b>"
I need the code to work for any keyword, and therefore using a hardcoded regular expression like /foo/i is not a sufficient solution.
What is the...
What's the best way to do case insensitive string comparison in Python?
I would like to encapsulate comparison of a regular strings to a repository string using in a very simple and pythonic way. I also would like to have ability to look up values in a dict hashed by strings using regular python strings. Much obliged for advice.
...
We are porting an app which formerly used Openbase 7 to now use MySQL 5.0.
OB 7 did have quite badly defined (i.e. undocumented) behavior regarding case-sensitivity. We only found this out now when trying the same queries with MySQL.
It appears that OB 7 treats lookups using "=" differently from those using "LIKE": If you have two valu...
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?
...
Is there a way to make the following return true?
string title = "ASTRINGTOTEST";
title.Contains("string");
There doesn't seem to be an overload that allows me to set the case sensitivity..
Currently I UPPERCASE them both, but that's just silly.
UPDATE
The sillyness I refer to is the i18n issues that come with up- and down casing.
...
In Python, I can compile a regular expression to be case-insensitive using re.compile:
>>> s = 'TeSt'
>>> casesensitive = re.compile('test')
>>> ignorecase = re.compile('test', re.IGNORECASE)
>>>
>>> print casesensitive.match(s)
None
>>> print ignorecase.match(s)
<_sre.SRE_Match object at 0x02F0B608>
Is there a way to do the same, bu...
I'm running Ubuntu 8.04 and my code looks like this...
for (i=1;i<=n;i++)
{
if (arr[i] ~ /^[A-Z]{2,4}$/) printf(arr[i])
}
I quickly discovered that the {n} expression won't work in gawk without the --posix switch. Once enabled the expression works but it is case-insenitive matching AAAA and aaaa. What is going on here?
...
I have searched for an elegant solution, without luck. Ultimately, I need to create a number of unique id's (on a single machine) of a fixed length (of 3 characters) that begin with a letter, and contains only numbers or uppercase letters. (e.g. AXX, where X can be a number or letter)
I am using the mktemp utility to generate the unique...
Is there a way to force SVN to be case insensitive? We have an issue where a user commits from a linux environment with files say "file.ext" and "File.ext". Works just fine. The problem, however, is when a user on a MAC OSX or Windows attempts an update/checkout. The two files are considered the same and the action fails in error.
...
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?
...
How can I make my clearquest search query case insensitive?
...
Hi,
I am new to Entity Framework, and ORM's for that mather.
In the project that I'm involed in we have a legacy database,
with all its keys as strings, case-insensitive.
We are converting to MSSQL and want to use EF as ORM,
but have run in to a problem.
Here is an example that illustrates our problem:
TableA has a primary string k...
Is it better for sake of compatibility/JIT-Compiling performance to use UPPER CASE or lower case, in JS/HTML? For eg:
<DIV> my content </DIV>
<div> my content </div>
ALERT(DOCUMENT.LOCATION);
alert(document.location);
This is not a newbie question, I know lowercase is the de-facto standard. But since I've seen some uppercase JS+H...
I want to add some constraint to my username VARCHAR in the sql table so that if a username exists, a duplicate username in a different case cannot be created. How can I do this? thanks
edit: I am using postgres sql, a little syntax help will be greatly appreicated
...
Wondering if this is possible.
We have an 3rd Party library that contains identification information about users...
The main interaction with the library is through a HashTable which is keyed with a string, and returns an Object Graph of information for that key.
The problem is, the key is obviously Case Sensitive, but what we get fro...
I'm using SQLite from a C# program using SQLite.net ( http://sqlite.phxsoftware.com ).
By default SQLite select order by clause sort is case sensitive, I want the result to sort case insensitive, I found "COLLATE NOCASE" but the documentation says it will only handle English characters in the ascii range, I want true linguistic internat...
What's the easiest way to do a case-insensitive str.replace in Python?
...