uppercase

Why do upper case letters come before lower case letters in the ASCII table?

限于喜欢 提交于 2019-12-05 04:11:47
In one of my interview, the interviewer asked me why the upper case letters are before the lower case letters in ASCII table, I searched on google.com but found nothing, could anyone gave me the answer? Thx a lot! I'm only guessing, but I imagine it's because the earliest character sets had no lowercase at all. The Baudot telegraph code was only 5 bits, and CDC mainframes natively used a 6-bit code; there was no room for lowercase. When ASCII was developed as a 7-bit code which finally had enough room for lowercase letters, they were considered something of a luxury add-on, so it made sense to

How does s[i]^=32 convert upper to lower case?

孤者浪人 提交于 2019-12-05 03:42:26
int main() { string s; cout << "enter the string :" << endl; cin >> s; for (int i = 0; i < s.length(); i++) s[i] ^= 32; cout << "modified string is : " << s << endl; return 0; } I saw this code which converts uppercase to lowercase on stackoverflow. But I don't understand the line s[i] = s[i]^32 . How does it work? ^= is the exclusive-or assignment operator. 32 is 100000 in binary, so ^= 32 switches the fifth bit in the destination. In ASCII, lower and upper case letters are 32 positions apart, so this converts lower to upper case, and also the other way. But it only works for ASCII, not for

Grails: How to make everything I create Upper Case?

只愿长相守 提交于 2019-12-05 02:10:16
I am currently using CSS to change everything I write to upperCase when I create an entry, but that is not enough. When I save things, the text shown in the text fields is upper case, but the real value that Grails stores stays in lower case. I am assuming I'd need to change something in the controller or anything. Maybe transforming the $fieldValue CSS could work?? Any ideas would help! Thnks! You could just write setters for your domain object? class Domain { String aField void setAField( String s ){ aField = s?.toUpperCase() } } I think you are asking how to change values on your domain

Why Java Character.toUpperCase/toLowerCase has no Locale parameter like String.toUpperCase/toLowerCase

社会主义新天地 提交于 2019-12-05 01:24:34
I am wondering that why Character.toUpperCase/toLowerCase has no Locale parameter like String.toUpperCase/toLowerCase . I have to first uppercase of a text that can be in Any language. I have 2 solutions: Use Character.toUpperCase String text = "stack overflow"; StringBuilder sb = new StringBuilder(text); sb.setCharAt(0, Character.toUpperCase(sb.charAt(0))); // No Locale parameter here. String out = sb.toString(); //Out: Stack overflow Use String.toUpperCase Locale myLocale = new Locale(locateId); String text = "stack overflow"; String text1 = text.substring(0,1).toUpperCase(myLocale ); String

How do I make text-transform:uppercase work properly with Greek?

帅比萌擦擦* 提交于 2019-12-04 22:42:38
The issue I came across has to do with the capitalization of Greek characters by the text-transform: uppercase property. In Greek, vowels can have acute accents, both small and caps, for instance one in Greek is ένα . In the beginning of a sentence would be Ένα . But when a word or a phrase is written in all caps then Greek grammar says that it should have no accented letters . As it is now, CSS's text-transform: uppercase capitalizes Greek letters preserving accents which is grammatically wrong (so ένα becomes ΈΝΑ , while it should be ΕΝΑ ). How do I make text-transform: uppercase work

checking if character is upper or lower case in alphanumeric

故事扮演 提交于 2019-12-04 20:34:32
I have this C code. If I input a LOL123 it should display that it is uppercase. And lol123 it is in lowercase. How do I use isalpha in excluding non-numerical input when checking isupper or is lower? #include <stdio.h> #define SIZE 6 char input[50]; int my_isupper(char string[]); int main(){ char input[] = "LOL123"; int m; m= isupper(input); if( m==1){ printf("%s is all uppercase.\n", input); }else printf("%s is not all uppercase.\n", input); return 0; } int my_isupper(char string[]){ int a,d; for (a=0; a<SIZE); a++){ d= isupper(string[a]) ; } if(d != 0) d=1; return d; } For upper-case

how to map an array with uppercase function in javascript?

空扰寡人 提交于 2019-12-04 17:11:33
问题 I'm interested if there is any function like array_map or array_walk from php. Don't need an for that travels all the array. I can do that for myself. var array = ['dom', 'lun', 'mar', 'mer', 'gio', 'ven', 'sab']; // i would like something like this if exists - function(array, 'upperCase'); 回答1: You can use $.map() in order to apply String.toUpperCase() (or String.toLocaleUpperCase(), if appropriate) to your array items: var upperCasedArray = $.map(array, String.toUpperCase); Note that $.map(

Java replace characters with uppercase around (before and after) specific character

青春壹個敷衍的年華 提交于 2019-12-04 13:16:39
I have this kind of input word w'ord wo'rd I need to convert to uppercase both characters at the starts of the word and right after the ' character (which can exists multiple times). The output I need (using the previous example) is word W'Ord Wo'Rd I tried with a simple pattern s.replaceAll("(\\w)(\\w*)'(\\w)", "$1"); but I'm unable to convert the group 1 and 3 to uppercase EDIT: After I discovered a little mistake in the main question, I edited @Wiktor Stribizew code in order to include the case I missed. Matcher m = Pattern.compile("(\\w)(\\w*)'(\\w)").matcher(s); StringBuffer result = new

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];

How to Convert a C++ String to Uppercase

流过昼夜 提交于 2019-12-04 09:03:59
问题 I need to convert a string in C++ to full upper case. I've been searching for a while and found one way to do it: #include <iostream> #include <algorithm> #include <string> using namespace std; int main() { string input; cin >> input; transform(input.begin(), input.end(), input.begin(), toupper); cout << input; return 0; } Unfortunately this did not work and I received this error message: no matching function for call to 'transform(std::basic_string::iterator, std::basic_string::iterator, std