Two conditions using OR in XPATH
and and or are allowed inside the condition: [here]. Or you may also use multiple paths in one XPath expression using the pipe sign. //PeopleList/Row[c1] | //PeopleList/Row[c2]
and and or are allowed inside the condition: [here]. Or you may also use multiple paths in one XPath expression using the pipe sign. //PeopleList/Row[c1] | //PeopleList/Row[c2]
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
use array_map(): $yourArray = array_map(‘strtolower’, $yourArray); In case you need to lowercase nested array (by Yahya Uddin): $yourArray = array_map(‘nestedLowercase’, $yourArray); function nestedLowercase($value) { if (is_array($value)) { return array_map(‘nestedLowercase’, $value); } return strtolower($value); }
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
The lower-case “requirement” is a legacy of xHTML, which explicitly required it. Plain old HTML on the other hand does not follow the rigid struct requirements of XML, and does not therefore have the fixed requirement for use of case. However developers have tended to stick with lower case as a convention anyway, mainly on … Read more
Smaller still I quite like: rename ‘y/A-Z/a-z/’ * On case insensitive filesystems such as OS X’s HFS+, you will want to add the -f flag: rename -f ‘y/A-Z/a-z/’ *
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
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
It’s in the standard library, and that’s the most straight forward way I can see to implement such a function. So yes, just loop through the string and convert each character to lowercase. Something trivial like this: #include <ctype.h> for(int i = 0; str[i]; i++){ str[i] = tolower(str[i]); } or if you prefer one liners, … Read more
Use str.lower(): “Kilometer”.lower()