uppercase

Script to automatically capitalize contents of a cell in Google Sheets?

不羁岁月 提交于 2019-12-04 06:06:33
问题 I have a spreadsheet that takes input of stock symbols. I would like them to always be in ALL CAPS regardless of how they are typed in. This appears to require some scripting as there is no way to do this with a function unless a second copy of the column exists, which is not acceptable. I have a solution which works, with one critical problem. The code is as follows: function OnEdit(e) { var ss = e.source.getActiveSheet(), sheets = ['Trades', ''], ind = sheets.indexOf(ss.getName()); if (ind

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

纵然是瞬间 提交于 2019-12-04 03:52:00
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. Or use Typography.Capitals="AllSmallCaps" in your TextBlock definition. See here: MSDN - Typography.Capitals EDIT: This does not work in Windows Phone 8.1 , only in Windows 8.1 ... kidshaw Implement a custom converter. using System

Turn a User Input String to Upper Case Java

不羁的心 提交于 2019-12-04 01:16:33
问题 This may seem like a silly question, but after going through pages of google, i havnt been able to find the answer i want. s1.setName(JOptionPane.showInputDialog("Enter Name: "); For the above piece fo code, how would i format the data the user entered to be all capitals? Any help here would be appreciated. 回答1: The String class has a toUpperCase() method on it. JOptionPane.showInputDialog(..) returns a String, so you can use: JOptionPane.showInputDialog("Enter name: ").toUpperCase(); 回答2:

Checking if string is in uppercase in R

…衆ロ難τιáo~ 提交于 2019-12-03 22:32:12
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 avoid bloated code. The uppercase pattern can be generalized to arbitrarily regex pattern (or character

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

怎甘沉沦 提交于 2019-12-03 21:59:47
This question already has answers here : Closed 2 years ago . Changing the first letter of every line in a file to uppercase (6 answers) 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". . choroba 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 "${line^}" ; done Split your file in first character/rest of line, upper the first and paste te

Count the uppercase letters in a string with Python

我与影子孤独终老i 提交于 2019-12-03 20:36:42
问题 I am trying to figure out how I can count the uppercase letters in a string. I have only been able to count lowercase letters: def n_lower_chars(string): return sum(map(str.islower, string)) Example of what I am trying to accomplish: Type word: HeLLo Capital Letters: 3 When I try to flip the function above, It produces errors: def n_upper_chars(string): return sum(map(str.isupper, string)) 回答1: You can do this with sum, a generator expression, and str.isupper: message = input("Type word: ")

Swap case of letters in string input parameter [closed]

核能气质少年 提交于 2019-12-03 15:11:27
I would like to write a function in Python that takes a string which has lower and upper case letters as a parameter and converts upper case letters to lower case, and lower case letters to upper case. For example: >>> func('DDDddddd') 'dddDDDDD' I want to do it with strings but I couldn't figure out how. EDIT - Way simpler than my original answer, and supports both ASCII and unicode. Thanks commenters. a = 'aBcD' a.swapcase() >> AbCd Original answer - disregard a = 'aBcD' ''.join(map(str.swapcase, a)) >> AbCd This will map the str.swapcase() function to each element of the string a , swapping

Why should the first letter of a Java class be upper-cased? [closed]

不想你离开。 提交于 2019-12-03 14:40:20
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . Why should the first letter of a Java class be upper-cased? Is it not possible to run a program containing lower-cased class names? If

how to change characters case to Upper in NSAttributedString

落爺英雄遲暮 提交于 2019-12-03 13:08:14
I want to convert NSAttributedString containing RTFD to uppercase without losing attributes of existing characters and graphics. Thanks, EDIT: @fluidsonic Is correct that the original code is incorrect. Below is an updated version in Swift, that replaces the text in each attribute range with an uppercased version of the string in that range. extension NSAttributedString { func uppercased() -> NSAttributedString { let result = NSMutableAttributedString(attributedString: self) result.enumerateAttributes(in: NSRange(location: 0, length: length), options: []) {_, range, _ in result

how to convert Lower case letters to upper case letters & and upper case letters to lower case letters

和自甴很熟 提交于 2019-12-03 12:36:06
Alternately display any text that is typed in the textbox // in either Capital or lowercase depending on the original // letter changed. For example: CoMpUtEr will convert to // cOmPuTeR and vice versa. Switch.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e ) String characters = (SecondTextField.getText()); //String to read the user input int length = characters.length(); //change the string characters to length for(int i = 0; i < length; i++) //to check the characters of string.. { char character = characters.charAt(i); if(Character.isUpperCase(character)) {