uppercase

how to map an array with uppercase function in javascript?

安稳与你 提交于 2019-12-03 10:08:58
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'); 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() builds a new array. If you want to modify your existing array in-place, you can use $.each() with an

How to find all upper case strings in a MySQL table?

妖精的绣舞 提交于 2019-12-03 07:36:39
问题 I initially thought this is trivial. Then thought 'binary' might do it. I am unsure at this point. Name ---- John MARY Kin TED I would like to query just MARY and TED which are in all upper case. How would I query this? 回答1: If your collation is case insensitive then you need to use a BINARY comparison: SELECT * FROM yourtable WHERE Name = BINARY UPPER(Name) See it working online: sqlfiddle 回答2: You just use the UPPER() function on the Name field and compare the results with the original

Permutate a String to upper and lower case

烂漫一生 提交于 2019-12-03 07:25:25
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 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]; } System.out.println(permutation); } } boolean isBitSet(int n, int offset) { return (n >> offset & 1) != 0;

SQL changing a value to upper or lower case

混江龙づ霸主 提交于 2019-12-03 06:28:06
问题 How do you make a field in a sql select statement all upper or lower case? Example: select firstname from Person How do I make firstname always return upper case and likewise always return lower case? 回答1: SELECT UPPER(firstname) FROM Person SELECT LOWER(firstname) FROM Person 回答2: LCASE or UCASE respectively. Example: SELECT UCASE(MyColumn) AS Upper, LCASE(MyColumn) AS Lower FROM MyTable 回答3: SQL SERVER 2005: print upper('hello'); print lower('HELLO'); 回答4: You can use LOWER function and

Automatically capitalize first letter of first word in a new sentence in LaTeX

寵の児 提交于 2019-12-03 06:16:21
I know one of LaTeX's bragging points is that it doesn't have this Microsoftish behavior. Nevertheless, it's sometimes useful. LaTeX already adds an extra space after you type a (non-backslashed) period, so it should be possible to make it automatically capitalize the following letter as well. Is there an obvious way to write a macro that does this, or is there a LaTeX package that does it already? The following code solves the problem. \let\period. \catcode`\.\active \def\uppercasesingleletter#1{\uppercase{#1}} \def.{\period\afterassignment\periodx\let\next= } \def \periodx{\ifcat\space\next

SQL query to make all data in a column UPPER CASE?

喜夏-厌秋 提交于 2019-12-03 05:22:02
问题 I need a SQL query to make all data in a column UPPER CASE? Any ideas? 回答1: Permanent: UPDATE MyTable SET MyColumn = UPPER(MyColumn) Temporary: SELECT UPPER(MyColumn) AS MyColumn FROM MyTable 回答2: If you want to only update on rows that are not currently uppercase (instead of all rows), you'd need to identify the difference using COLLATE like this: UPDATE MyTable SET MyColumn = UPPER(MyColumn) WHERE MyColumn != UPPER(MyColumn) COLLATE Latin1_General_CS_AS A Bit About Collation Cases

Lowercase characters to Uppercase characters in C & writing to file

青春壹個敷衍的年華 提交于 2019-12-02 23:39:19
问题 I am reading content from a file to be read into a char array in C. How could I change all the letters in the file that are lowercase to uppercase letters? 回答1: Here's a possible algorithm: Open a file (let's call it A) - fopen() Open another file to write (let's call it B) - fopen() Read the content of A - getc() or fread(); whatever you feel free Make the content you read uppercase - toupper() Write the result of the 4-step to B - fwrite() or fputc() or fprintf() Close all file handles -

How to find all upper case strings in a MySQL table?

廉价感情. 提交于 2019-12-02 21:06:26
I initially thought this is trivial. Then thought 'binary' might do it. I am unsure at this point. Name ---- John MARY Kin TED I would like to query just MARY and TED which are in all upper case. How would I query this? If your collation is case insensitive then you need to use a BINARY comparison: SELECT * FROM yourtable WHERE Name = BINARY UPPER(Name) See it working online: sqlfiddle You just use the UPPER() function on the Name field and compare the results with the original value of Name : select Name from Table where Name = UPPER(Name) This way UPPER(Name) || Name ------------------------

SQL changing a value to upper or lower case

谁都会走 提交于 2019-12-02 19:54:56
How do you make a field in a sql select statement all upper or lower case? Example: select firstname from Person How do I make firstname always return upper case and likewise always return lower case? SELECT UPPER(firstname) FROM Person SELECT LOWER(firstname) FROM Person Stephen Wrighton LCASE or UCASE respectively. Example: SELECT UCASE(MyColumn) AS Upper, LCASE(MyColumn) AS Lower FROM MyTable SQL SERVER 2005: print upper('hello'); print lower('HELLO'); You can use LOWER function and UPPER function . Like SELECT LOWER('THIS IS TEST STRING') Result: this is test string And SELECT UPPER('this

Converting Odd and Even-indexed characters in a string to uppercase/lowercase in Javascript?

南笙酒味 提交于 2019-12-02 18:15:36
问题 I need to make a function that reads a string input and converts the odd indexed characters in the string to upperCase and the even ones to lowerCase. function alternativeCase(string){ for(var i = 0; i < string.length; i++){ if (i % 2 != 0) { string[i].toUpperCase(); } else { string[i].toLowerCase(); } } return string; } How to fix my code? 回答1: Try this: function alternativeCase(string){ var output = ""; for(var i = 0; i < string.length; i++){ if (i % 2 != 0) { output += string[i]