Converting a char to uppercase in Java

You can use Character#toUpperCase() for this. char fUpper = Character.toUpperCase(f); char lUpper = Character.toUpperCase(l); It has however some limitations since the world is aware of many more characters than can ever fit in 16bit char range. See also the following excerpt of the javadoc: Note: This method cannot handle supplementary characters. To support all Unicode … Read more

Count the uppercase letters in a string with Python

You can do this with sum, a generator expression, and str.isupper: message = input(“Type word: “) print(“Capital Letters: “, sum(1 for c in message if c.isupper())) See a demonstration below: >>> message = input(“Type word: “) Type word: aBcDeFg >>> print(“Capital Letters: “, sum(1 for c in message if c.isupper())) Capital Letters: 3 >>>

Python title() with apostrophes

If your titles do not contain several whitespace characters in a row (which would be collapsed), you can use string.capwords() instead: >>> import string >>> string.capwords(“john’s school”) “John’s School” EDIT: As Chris Morgan rightfully says below, you can alleviate the whitespace collapsing issue by specifying ” ” in the sep argument: >>> string.capwords(“john’s school”, ” … Read more

Convert whole dataframe from lower case to upper case with Pandas

astype() will cast each series to the dtype object (string) and then call the str() method on the converted series to get the string literally and call the function upper() on it. Note that after this, the dtype of all columns changes to object. In [17]: df Out[17]: regiment company deaths battles size 0 Nighthawks … Read more

Make input value uppercase in CSS without affecting the placeholder

Each browser engine has a different implementation to control placeholder styling. Use the following: jsBin example. input { text-transform: uppercase; } ::-webkit-input-placeholder { /* WebKit browsers */ text-transform: none; } :-moz-placeholder { /* Mozilla Firefox 4 to 18 */ text-transform: none; } ::-moz-placeholder { /* Mozilla Firefox 19+ */ text-transform: none; } :-ms-input-placeholder { /* … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)