uppercase

string.toUppercase() created a new object in heap or string pool

半世苍凉 提交于 2019-12-06 14:12:24
If we use toUpperCase() method of String class, does it put the object in the heap rather than creating it in the String pool. Below is the code, when I ran, I could infer that newly created string objects are not in String pool. public class Question { public static void main(String[] args) { String s1="abc"; System.out.println(s1.toUpperCase()==s1.toUpperCase()); } } Output of the above code return false . I know about "==" and equals() difference but in this question I am wondering why the two created strings are not equal. The only explanation could be that they are not created in the

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

Java replace characters with uppercase around (before and after) specific character

夙愿已清 提交于 2019-12-06 07:31:01
问题 I have this kind of input word w'ord wo'rd I need to convert to uppercase both characters at the starts of the word and right after the ' character (which can exists multiple times). The output I need (using the previous example) is word W'Ord Wo'Rd I tried with a simple pattern s.replaceAll("(\\w)(\\w*)'(\\w)", "$1"); but I'm unable to convert the group 1 and 3 to uppercase EDIT: After I discovered a little mistake in the main question, I edited @Wiktor Stribizew code in order to include the

R plot title with uppercase and italic

巧了我就是萌 提交于 2019-12-06 05:01:51
I'm trying to make a title with italic and uppercase text. Right now I have this code line: main=substitute(paste(italic("S. aureus"), " (10^6) growth inhibition" )) Any idea how to make the 6 uppercase? We can try plot(1, main=expression(paste(italic("S. aureus"), " (10"^{6}*")"~"growth inhibition" ))) 来源: https://stackoverflow.com/questions/33584083/r-plot-title-with-uppercase-and-italic

WPF/XAML: How to make all text upper case in TextBlock?

假如想象 提交于 2019-12-05 21:49:43
问题 I want all characters in a TextBlock to be displayed in uppercase <TextBlock Name="tbAbc" FontSize="12" TextAlignment="Center" Text="Channel Name" Foreground="{DynamicResource {x:Static r:RibbonSkinResources.RibbonGroupLabelFontColorBrushKey}}" /> The strings are taken through Binding. I don't want to make the strings uppercase in the dictionary itself. 回答1: Or use Typography.Capitals="AllSmallCaps" in your TextBlock definition. See here: MSDN - Typography.Capitals EDIT: This does not work in

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

Checking if string is in uppercase in R

不打扰是莪最后的温柔 提交于 2019-12-05 12:53:41
问题 Is there simpler method to match regex pattern in its entirety? For example, to check if given string is uppercase the following 2 methods but seem too complex. Checking stringr I found no indication for simpler solution either. Method 1: isUpperMethod1 <- function(s) { return (all(grepl("[[:upper:]]", strsplit(s, "")[[1]]))) } Method 2: isUpperMethod2 <- function(s) { m = regexpr("[[:upper:]]+", s) return (regmatches(s, m) == s) } I intentionally omit handling of empty, NA, NULL strings to

How to set a string to all lowercase [duplicate]

折月煮酒 提交于 2019-12-05 11:19:44
This question already has an answer here: How do I lowercase a string in C? 5 answers 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. foo isn't a pointer, so you don't want to use it as one. You also don't have to check whether a character is an upper-case letter before using tolower -- it converts upper to lower case, and

How to count CAPSLOCK in string using R

十年热恋 提交于 2019-12-05 09:03:50
问题 In src$Review each row is filled with text in Russian. I want to count the CAPSLOCK in each row. For example, in "My apple is GREEN" I want to count not just the quantity of capital letters, but the amount of CAPSLOCK (without "My", only "GREEN"). So, it works only if at least two characters are presented in uppercase. Now I have following code in my script: capscount <- str_count(src$Review, "[А-Я]") It counts only the total amount of capital letters. I only need the total amount of

How to capitalize first letter of each line in bash? [duplicate]

和自甴很熟 提交于 2019-12-05 08:14:50
问题 This question already has answers here : Changing the first letter of every line in a file to uppercase (6 answers) Closed 2 years ago . I'm looking for a command that capitalizes the first letter of each line in bash. Actually I used this command: sed 's/^\(.\)/\U\1/' But I need to use another command instead of "\U". . 回答1: Why do you need to use something else than \U ? You can use \u which only capitalizes one letter: sed 's/./\u&/' Or, use parameter expansion: while read line ; do echo "