The Show
Example
Syntax of String upper()The syntax of string.upper() upper() Parameters
upper() Return Value
If no lowercase characters exist, it returns the original string. Example 1: Convert a string to uppercase
Output THIS SHOULD BE UPPERCASE! TH!S SH0ULD B3 UPP3RCAS3! Example 2: How upper() is used in a program?
Output The strings are same. Note: If you want to convert to lowercase string, use lower(). You can also use swapcase() to swap between lowercase to uppercase. Skip to main content This browser is no longer supported. Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support. String.ToLower Method
DefinitionReturns a copy of this string converted to lowercase. In this articleOverloads
ToLower()Returns a copy of this string converted to lowercase.
ReturnsStringA string in lowercase. ExamplesThe following example converts several mixed case strings to lowercase.
RemarksThis method takes into account the casing rules of the current culture. Note This method does not modify the value of the current instance. Instead, it returns a new string in which all characters in the current instance are converted to lowercase. Security ConsiderationsThe casing operation that results from calling the ToLower() method takes the casing conventions of the current culture into account. If you need the lowercase or uppercase version of an operating system identifier, such as a file name, named pipe, or registry key, use the ToLowerInvariant or ToUpperInvariant methods. This produces the same result in every culture (unlike the ToLower() method) and performs more efficiently. Notes to CallersAs explained in Best Practices for Using Strings, we recommend that you avoid calling string casing methods that
substitute default values and instead call methods that require parameters to be explicitly specified. To convert a character to lowercase by using the casing conventions of the current culture, call the ToLower(CultureInfo) method overload with a value of
CurrentCulture for its See also
Applies toToLower(CultureInfo)Returns a copy of this string converted to lowercase, using the casing rules of the specified culture.
Parametersculture CultureInfo An object that supplies culture-specific casing rules. If ReturnsStringThe lowercase equivalent of the current string. ExamplesThe following example converts two strings of uppercase characters to lowercase characters using the English-United States and Turkish-Turkey cultures, then compares the lowercase strings. The uppercase strings are identical except that for each occurrence of the Unicode LATIN CAPITAL LETTER I in one string, the other string contains LATIN CAPITAL LETTER I WITH DOT ABOVE.
RemarksThe casing rules of the culture specified by the Note This method does not modify the value of the current instance. Instead, it returns a new string in which all characters in the current instance are converted to lowercase. Security ConsiderationsIf you pass the ToLower(CultureInfo) method a CultureInfo object other than CultureInfo.InvariantCulture, the casing operation will take culture-specific rules into account. If you need the lowercase or uppercase version of an operating system identifier, such as a file name, named pipe, or registry key, use the ToLowerInvariant or ToUpperInvariant method. This produces the same result in every culture and performs more efficiently. See also
Applies toWhat string method can be used to determine if the string contained in the variable text only consists of numbers?To determine whether a string is a valid representation of a specified numeric type, use the static TryParse method that is implemented by all primitive numeric types and also by types such as DateTime and IPAddress.
What are the two parts of an if statement Python?There are two indented blocks: One, like in the simple if statement, comes right after the if heading and is executed when the condition in the if heading is true. In the if - else form this is followed by an else: line, followed by another indented block that is only executed when the original condition is false.
Which of the following operators is used to invert a conditional statement?Logical OR - Perform a logical OR operation on two conditionals. If either conditional is true the entire statement is true. Logical NOT - Perform a logical NOT operation on a single conditional. This inverts the result of the conditional.
|