lowercase

Is there a function to find all lower case letters in a character vector?

爷,独闯天下 提交于 2019-12-07 13:15:32
问题 I just wrote one, but I was wondering if one already exists in R. Here's the function BTW (suggestions for improvement are welcome): set.seed(50) x <- sample(c(letters, LETTERS), 7) is.lower <- function(x) { unlist(sapply(x, function(x2) {x2 %in% letters})) } is.lower(x) 回答1: grepl("[a-z]",x) for example? > grepl("[a-z]",x) [1] FALSE TRUE TRUE FALSE TRUE TRUE FALSE And why make it difficult? > x %in% letters [1] FALSE TRUE TRUE FALSE TRUE TRUE FALSE No need to make your own function. 回答2:

Using the lowercase function with CSV rows

会有一股神秘感。 提交于 2019-12-07 10:55:52
问题 I'm trying to print all data from a csv in lowercase, but I'm not having any luck. Here's what I have so far: import csv books = csv.reader(open("books.csv","rb")) for row in books: print row This prints all the content of the csv, but when I add the .lower() function, I get errors. What am I doing wrong? 回答1: Try print [r.lower() for r in row] 来源: https://stackoverflow.com/questions/8265648/using-the-lowercase-function-with-csv-rows

How to set a string to all lowercase [duplicate]

落花浮王杯 提交于 2019-12-07 05:19:23
问题 This question already has answers here : How do I lowercase a string in C? (5 answers) Closed 6 years ago . I have a char foo[SIZE]; //(string) and have inputed it correctly using %s (as in it printfs the correct input), but now want to set it to lowercase. So I tried using if (isupper(*foo)) *foo=tolower(*foo); ie when I do: printf("%s" foo); //I get the same text with upper case The text does not seem to change. Thank you. 回答1: foo isn't a pointer, so you don't want to use it as one. You

Why Java Character.toUpperCase/toLowerCase has no Locale parameter like String.toUpperCase/toLowerCase

三世轮回 提交于 2019-12-06 20:33:15
问题 I am wondering that why Character.toUpperCase/toLowerCase has no Locale parameter like String.toUpperCase/toLowerCase . I have to first uppercase of a text that can be in Any language. I have 2 solutions: Use Character.toUpperCase String text = "stack overflow"; StringBuilder sb = new StringBuilder(text); sb.setCharAt(0, Character.toUpperCase(sb.charAt(0))); // No Locale parameter here. String out = sb.toString(); //Out: Stack overflow Use String.toUpperCase Locale myLocale = new Locale

javascript Regex split UpperCase from lowerCase

不想你离开。 提交于 2019-12-06 15:11:38
I got a string like: var str = new Array( "Inverted HFFSfor Primary Wrap Or Secondary Multi Wrap", "HFFSwith PDSPbackgroud Feederlense & Product Alignerigit", "HFFSwith Cooler JKLHbetween Feeder & Product Aligner") How to separate i.e. 1) HFFSfor to become HFFS for 2) HFFSwith to become HFFS with 3) PDSPbackgroud to become PDSP backgroud 4) JKLHbetween to become JKLH between and so forth... My first instinc was something like: for(var i = 0; i<_str.length; i++){ if( (/*The needed Regex*/).test(_str[i]) ){ } } No Success.... Can't seem to think further!! Please help, Thanks indexOf doesn't

What's the expected outcome of uppercasing embedded English words in Turkish text?

纵然是瞬间 提交于 2019-12-06 13:02:41
I am aware of the Turkish "I" problem, where uppercasing of "i" is different in Turkish and in English. However, does Turkish commonly embed foreign words (e.g. English names) in Turkish text? For example let's say someone embeds the text "Microsoft Windows" in otherwise Turkish text and I'd like to uppercase the text. Should the "i"'s in the English words (company and product) be uppercased using English rules or using Turkish rules? Or would the English word already be such a form that uppercasing/lowercasing of it using Turkish rules would give the expected results for Turkish speakers? Yes

Python: Using lower function on tuples

这一生的挚爱 提交于 2019-12-06 08:08:18
I'm new to Python and have looked at quite a bit of documentation to figure out what is going on, but haven't had any luck. I have a list of tuples that I need to convert to lowercase and perform mathematical operations on all values in the list. The "E", needs to become an "e" in order to perform mathematical operations. If there is a single value in a given list of tuples, the following works: EarthU = ['1.3719107E+11', '8.3311764E-02', '2.2719107E+11', '1.4880643E+03'] earthU = [element.lower() for element in EarthU] earthU = [(0.3048*0.3048)*float(element) for element in earthU] If there

How to add lowercase field to NSURLRequest header field?

情到浓时终转凉″ 提交于 2019-12-06 07:48:52
问题 I'm getting pretty frustrated figuring out how to add a lowercase header field to an NSMutableURLRequest. NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:MyURLString]]; [urlRequest setValue:@"aValue" forHTTPHeaderField:@"field"]; In the example above, "field" gets switched to "Field," since the header field names are case insensitive. I would think this shouldn't happen, but it does. The API I am working with is case sensitive, so my GET request is

Determining the case (upper/lower) of the first letter in a string

守給你的承諾、 提交于 2019-12-05 20:53:46
In a web application, how do I determine whether the first letter in a given string is upper- or lower-case using JavaScript? You can use toUpperCase : if(yourString.charAt(0) === yourString.charAt(0).toUpperCase()) { //Uppercase! } If you're going to be using this on a regular basis, I would suggest putting it in a function on the String prototype, something like this: String.prototype.isFirstCapital = function() { return this.charAt(0) === this.charAt(0).toUpperCase(); } if(yourString.isFirstCapital()) { //Uppercase! } Update (based on comments) I don't know what you actually want to do in

Is there a function to find all lower case letters in a character vector?

偶尔善良 提交于 2019-12-05 18:33:59
I just wrote one, but I was wondering if one already exists in R. Here's the function BTW (suggestions for improvement are welcome): set.seed(50) x <- sample(c(letters, LETTERS), 7) is.lower <- function(x) { unlist(sapply(x, function(x2) {x2 %in% letters})) } is.lower(x) grepl("[a-z]",x) for example? > grepl("[a-z]",x) [1] FALSE TRUE TRUE FALSE TRUE TRUE FALSE And why make it difficult? > x %in% letters [1] FALSE TRUE TRUE FALSE TRUE TRUE FALSE No need to make your own function. Another approach with the values instead of a logical index as the result, would be to name the letters as