lowercase

python 2.7 lowercase

无人久伴 提交于 2019-12-04 15:48:03
问题 When I use .lower() in Python 2.7, string is not converted to lowercase for letters ŠČŽ . I read data from dictionary. I tried using str(tt["code"]).lower() , tt["code"].lower() . Any suggestions ? 回答1: Use unicode strings: drostie@signy:~$ python Python 2.7.2+ (default, Oct 4 2011, 20:06:09) [GCC 4.6.1] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> print "ŠČŽ" ŠČŽ >>> print "ŠČŽ".lower() ŠČŽ >>> print u"ŠČŽ".lower() ščž See that little u ? That means

Why does the standard C++ library use all lower case?

时间秒杀一切 提交于 2019-12-04 15:25:51
问题 Just curious why the C++ standard library uses all lower case and underscores instead of camelCase or PascalCase naming convention. Personally, I find the latter much easier to deal with when typing out code, but is there some kind of legitimate reason to use the former? 回答1: Main reason : To keep compatibility with the existing code, since they have done it with C also. Also have a look at these C++ Coding standards, which presents some generic reasoning regarding the importance of

How to add lowercase field to NSURLRequest header field?

三世轮回 提交于 2019-12-04 13:13:40
I'm getting pretty frustrated figuring out how to add a lowercase header field to an NSMutableURLRequest. NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:MyURLString]]; [urlRequest setValue:@"aValue" forHTTPHeaderField:@"field"]; In the example above, "field" gets switched to "Field," since the header field names are case insensitive. I would think this shouldn't happen, but it does. The API I am working with is case sensitive, so my GET request is ignored. Is there any way to override the case switch? HTTP header fields are supposed to be case

Permutate a String to upper and lower case

帅比萌擦擦* 提交于 2019-12-04 11:47:36
问题 I have a string, "abc". How would a program look like (if possible, in Java) who permute the String? For example: abc ABC Abc aBc abC ABc abC AbC 回答1: Something like this should do the trick: void printPermutations(String text) { char[] chars = text.toCharArray(); for (int i = 0, n = (int) Math.pow(2, chars.length); i < n; i++) { char[] permutation = new char[chars.length]; for (int j =0; j < chars.length; j++) { permutation[j] = (isBitSet(i, j)) ? Character.toUpperCase(chars[j]) : chars[j];

Convert typed-in Text to lowercase

和自甴很熟 提交于 2019-12-04 05:08:57
问题 I've got an index.jsp with [snip] <% String name = request.getParameter("name"); String pass = request.getParameter("pass"); String globalname = "webeng"; String globalpass = "2009"; if (name !=null && pass!=null && name.equals(globalname) && pass.equals(globalpass)) { %> <hr /> <p><b>Howdy, <%= request.getParameter("name") %></b></p> <hr /> <% } else if (name !=null | pass!=null && name.equals("") | pass.equals("")) { %> <hr /> <p><b>Ooops, one or more fields are empty. Please fill

Best way to convert whole file to lowercase in C

元气小坏坏 提交于 2019-12-04 04:22:28
问题 I was wondering if theres a realy good (performant) solution how to Convert a whole file to lower Case in C. I use fgetc convert the char to lower case and write it in another temp-file with fputc. At the end i remove the original and rename the tempfile to the old originals name. But i think there must be a better Solution for it. 回答1: If you're processing big files (big as in, say, multi-megabytes) and this operation is absolutely speed-critical, then it might make sense to go beyond what

Converting to text to lowercase in nodes and child nodes in xsl

喜你入骨 提交于 2019-12-04 04:00:52
问题 Using xsl 2.0 I'm trying to convert all uppercase text to having only the first letter of text in each node upper-case. Their are a large number of possible child elements. <text> text text text <head>BLAH <unkownTag>BLAH</unkownTag> BLAH </head> </text> I'd like to transform this to read <text> text text text <head>Blah <unkownTag>Blah</unkownTag> Blah </head> </text> The closest I've come is <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org

Case insensitive search in Rails [duplicate]

白昼怎懂夜的黑 提交于 2019-12-03 20:47:52
This question already has answers here : Closed 5 years ago . Case-insensitive search in Rails model (19 answers) The best way I've found to search for things where I specifically don't want character-case to matter is: @tag = Rails.env.development? ? Category.where("LOWER(name) LIKE ?", "%#{params[:find]}%")[0] : Category.where("LOWER(name) ILIKE ?", "%#{params[:find]}%")[0] I have to have the .env finder because I use Heroku, and I haven't cared to get PostgreSQL setup on my dev machines. Still, isn't there something like: @tag = Category.find_by_name(params[:find], case_sensitive: false)

lower_case_table_names=1 on Ubuntu 18.04 doesn't let mysql to start

∥☆過路亽.° 提交于 2019-12-03 17:13:08
I have installed mysql community server 8.013 on ubuntu 18.04 and I have the following issue. I want to set lower_case_table_names=1 in order to have case insensitive table names in my db. I edited /etc/mysql/mysql.conf.d/mysqld.cnf and added the following line under [mysqld] lower_case_table_names=1 mysqld.cnf now is as follows [mysqld] pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock datadir = /var/lib/mysql log-error = /var/log/mysql/error.log lower_case_table_names=1 I stopped the mysql server using sudo service mysql stop Then I tried to start it again using sudo

PHP: rename all files to lower case in a directory recursively

烂漫一生 提交于 2019-12-03 16:44:24
I need help. I want to rename all files to lower case within a directory recursively. I have a code to test but it only rename within that folder not recursively. How can I make it to do it recursively. This is the code I use <?php $directory="/data"; $files = scandir($directory); foreach($files as $key=>$name){ $oldName = $name; $newName = strtolower($name); rename("$directory/$oldName","$directory/$newName"); } ?> You can use the SPL's RecursiveDirectoryIterator for that. <?php $path = realpath('your/path/here'); $di = new RecursiveIteratorIterator( new RecursiveDirectoryIterator($path,