In Android EditText, how to force writing uppercase?

Android actually has a built-in InputFilter just for this! edittext.setFilters(new InputFilter[] {new InputFilter.AllCaps()}); Be careful, setFilters will reset all other attributes which were set via XML (i.e. maxLines, inputType,imeOptinos…). To prevent this, add you Filter(s) to the already existing ones. InputFilter[] editFilters = <EditText>.getFilters(); InputFilter[] newFilters = new InputFilter[editFilters.length + 1]; System.arraycopy(editFilters, 0, newFilters, 0, … Read more

Replace a Regex capture group with uppercase in Javascript

You can pass a function to replace. var r = a.replace(/(f)/, function(v) { return v.toUpperCase(); }); Explanation a.replace( /(f)/, “$1”.toUpperCase()) In this example you pass a string to the replace function. Since you are using the special replace syntax ($N grabs the Nth capture) you are simply giving the same value. The toUpperCase is actually … Read more

Upper vs Lower Case

Converting to either upper case or lower case in order to do case-insensitive comparisons is incorrect due to “interesting” features of some cultures, particularly Turkey. Instead, use a StringComparer with the appropriate options. MSDN has some great guidelines on string handling. You might also want to check that your code passes the Turkey test. EDIT: … Read more

Convert an entire range to uppercase without looping through all the cells

Is there a method I can use to convert the whole range in one line? Yes you can convert without looping. Try this Sub Sample() [A1:A20] = [INDEX(UPPER(A1:A20),)] End Sub Alternatively, using a variable range, try this: Sub Sample() Dim rng As Range Set rng = Range(“A1:A20”) rng = Evaluate(“index(upper(” & rng.Address & “),)”) End … Read more