Turkish case conversion in JavaScript

Coming back to this years later to provide more up to date solution. There is no need for the hack below, just use String.toLocaleUpperCase() and String.toLocaleLowerCase() “dinç”.toLocaleUpperCase(‘tr-TR’) // “DİNÇ” All modern browsers support this now. [ OLD, DO NOT USE THIS ] Try these functions String.prototype.turkishToUpper = function(){ var string = this; var letters = … Read more

Dictionary to lowercase in Python

You will need to use either a loop or a list/generator comprehension. If you want to lowercase all the keys and values, you can do this:: dict((k.lower(), v.lower()) for k,v in {‘My Key’:’My Value’}.iteritems()) If you want to lowercase just the keys, you can do this:: dict((k.lower(), v) for k,v in {‘My Key’:’My Value’}.iteritems()) Generator … Read more

Using upper-case and lower-case xpath functions in selenium IDE

upper-case() and lower-case() are XPath 2.0 functions. Chances are your platform supports XPath 1.0 only. Try: translate(‘some text’,’abcdefghijklmnopqrstuvwxyz’,’ABCDEFGHIJKLMNOPQRSTUVWXYZ’) which is the XPath 1.0 way to do it. Unfortunately, this requires knowledge of the alphabet the text uses. For plain English, the above probably works, but if you expect accented characters, make sure you add them … Read more

Use Java and RegEx to convert casing in a string

You can’t do this in Java regex. You’d have to manually post-process using String.toUpperCase() and toLowerCase() instead. Here’s an example of how you use regex to find and capitalize words of length at least 3 in a sentence String text = “no way oh my god it cannot be”; Matcher m = Pattern.compile(“\\b\\w{3,}\\b”).matcher(text); StringBuilder sb … Read more

Why can’t “transform(s.begin(),s.end(),s.begin(),tolower)” be complied successfully?

Let’s look at a list of options starting with the worst and moving to the best. We’ll list them here and discuss them below: transform(cbegin(s), cend(s), begin(s), ::tolower) transform(cbegin(s), cend(s), begin(s), static_cast<int(*)(int)>(tolower)) transform(cbegin(s), cend(s), begin(s), [](const unsigned char i){ return tolower(i); }) The code in your question, transform(s.begin(), s.end(), s.begin(), tolower) will produce an error … Read more