uppercase

change some lowercase letters to uppercase in string

感情迁移 提交于 2019-12-19 05:35:02
问题 index = [0, 2, 5] s = "I am like stackoverflow-python" for i in index: s = s[i].upper() print(s) IndexError: string index out of range I understand that in the first iteration the string, s , become just the first character, an uppercase "I" in this particular case. But, I have tried to do it without the "s = " , using swapchcase() instead, but it's not working. Basically, I'm trying to print the s string with the index letters as uppercase using Python 3.X 回答1: Strings are immutable in

Unicode characters having asymmetric upper/lower case. Why?

↘锁芯ラ 提交于 2019-12-18 19:37:06
问题 Why do the following three characters have not symmetric toLower , toUpper results /** * Written in the Scala programming language, typed into the Scala REPL. * Results commented accordingly. */ /* Unicode Character 'LATIN CAPITAL LETTER SHARP S' (U+1E9E) */ '\u1e9e'.toHexString == "1e9e" // true '\u1e9e'.toLower.toHexString == "df" // "df" == "df" '\u1e9e'.toHexString == '\u1e9e'.toLower.toUpper.toHexString // "1e9e" != "df" /* Unicode Character 'KELVIN SIGN' (U+212A) */ '\u212a'.toHexString

Directive to upper case input fields

一曲冷凌霜 提交于 2019-12-18 17:34:29
问题 I want to use a directive to transform all input data to uppercase. To achieve that, I create this custom directive : @Directive({ selector: '[appToUpperCase]' }) export class ToUpperCaseDirective { constructor() {} @HostListener('input', ['$event']) onKeyUp(event) { event.target['value'] = event.target['value'].toUpperCase(); } } And I use it like that : <form [formGroup]="formGroup" appToUpperCase> It works almost good exept that when I enter text in my field, the upper case transform is

How to check for uppercase letters in MySQL?

倖福魔咒の 提交于 2019-12-18 15:35:21
问题 I want to check, if a string consits only of uppercase letters. I know that RLIKE/REGEXP are not case sensitive in MySQL. So I tried to use the :upper: character class: SELECT 'z' REGEXP '^[[:upper:]]+$'; This gives true, although the z is in lower case,... why? 回答1: REGEXP is not case sensitive, except when used with binary strings. http://dev.mysql.com/doc/refman/5.7/en/regexp.html So with that in mind, just do something like this: SELECT * FROM `users` WHERE `email` REGEXP BINARY '[A-Z]';

Convert strings to UPPERCASE in SQL Server

倾然丶 夕夏残阳落幕 提交于 2019-12-18 13:53:19
问题 What is the T-SQL function for converting strings into upper case in SQL Server? 回答1: UPPER SELECT UPPER(LastName) + ', ' + FirstName AS Name FROM Person.Person 回答2: Try UPPER function: SELECT UPPER('Hello world!!!') Result: HELLO WORLD!!! 来源: https://stackoverflow.com/questions/5521188/convert-strings-to-uppercase-in-sql-server

How to extract all UPPER from a string? Python

假装没事ソ 提交于 2019-12-18 13:05:17
问题 #input my_string = 'abcdefgABCDEFGHIJKLMNOP' how would one extract all the UPPER from a string? #output my_upper = 'ABCDEFGHIJKLMNOP' 回答1: Using list comprehension: >>> s = 'abcdefgABCDEFGHIJKLMNOP' >>> ''.join([c for c in s if c.isupper()]) 'ABCDEFGHIJKLMNOP' Using generator expression: >>> ''.join(c for c in s if c.isupper()) 'ABCDEFGHIJKLMNOP You can also do it using regular expressions: >>> re.sub('[^A-Z]', '', s) 'ABCDEFGHIJKLMNOP' 回答2: import string s = 'abcdefgABCDEFGHIJKLMNOP' s

How to let Python recognize both lower and uppercase input?

北城余情 提交于 2019-12-18 09:03:33
问题 I am new to Python. I am writing a program that distinguishes whether or not a word starts with a vowel. The problem is, that the program is only able to correctly handle uppercase letters as input. For example, if I provide the word "Apple" as input, the result is True ; however, if the word "apple" is provided as input, the result is False . How do I fix it? word = input ("Please Enter a word:") if (word [1] =="A") : print("The word begins with a vowel") elif (word [1] == "E") : print("The

Windows batch file read text file and convert all to uppercase

喜夏-厌秋 提交于 2019-12-18 07:02:40
问题 I just simply want to replace all the text in the text file convert to uppercase. For example of abc.txt [Before conversion] First Name, Last Name, Full Name Brad, Pitt, Brad Pitt [After conversion] FIRST NAME, LAST NAME, FULL NAME BRAD, PITT, BRAD PITT Is that possible?? 回答1: The Batch file below do what you want, but if the file to convert is large this method is slow... @echo off setlocal EnableDelayedExpansion for /F "delims=" %%a in (%1) do ( set "line=%%a" for %%b in (A B C D E F G H I

Naming convention for upper case abbreviations [closed]

爱⌒轻易说出口 提交于 2019-12-18 01:23:34
问题 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 8 years ago . Should a method that returns an XML stream be called public Stream getXmlStream(); or instead public Stream getXMLStream(); What's

Naming convention for upper case abbreviations [closed]

自闭症网瘾萝莉.ら 提交于 2019-12-18 01:23:32
问题 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 8 years ago . Should a method that returns an XML stream be called public Stream getXmlStream(); or instead public Stream getXMLStream(); What's