Share via


String.ToUpperCase Method

Definition

Overloads

ToUpperCase()

Converts all of the characters in this String to upper case using the rules of the default locale.

ToUpperCase(Locale)

Converts all of the characters in this String to upper case using the rules of the given Locale.

ToUpperCase()

Converts all of the characters in this String to upper case using the rules of the default locale.

[Android.Runtime.Register("toUpperCase", "()Ljava/lang/String;", "")]
public string ToUpperCase ();
[<Android.Runtime.Register("toUpperCase", "()Ljava/lang/String;", "")>]
member this.ToUpperCase : unit -> string

Returns

the String, converted to uppercase.

Attributes

Remarks

Converts all of the characters in this String to upper case using the rules of the default locale. This method is equivalent to toUpperCase(Locale.getDefault()).

<b>Note:</b> This method is locale sensitive, and may produce unexpected results if used for strings that are intended to be interpreted locale independently. Examples are programming language identifiers, protocol keys, and HTML tags. For instance, "title".toUpperCase() in a Turkish locale returns "T\u005Cu0130TLE", where '\u005Cu0130' is the LATIN CAPITAL LETTER I WITH DOT ABOVE character. To obtain correct results for locale insensitive strings, use toUpperCase(Locale.ROOT).

Java documentation for java.lang.String.toUpperCase().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

ToUpperCase(Locale)

Converts all of the characters in this String to upper case using the rules of the given Locale.

[Android.Runtime.Register("toUpperCase", "(Ljava/util/Locale;)Ljava/lang/String;", "")]
public string ToUpperCase (Java.Util.Locale locale);
[<Android.Runtime.Register("toUpperCase", "(Ljava/util/Locale;)Ljava/lang/String;", "")>]
member this.ToUpperCase : Java.Util.Locale -> string

Parameters

locale
Locale

use the case transformation rules for this locale

Returns

the String, converted to uppercase.

Attributes

Remarks

Converts all of the characters in this String to upper case using the rules of the given Locale. Case mapping is based on the Unicode Standard version specified by the java.lang.Character Character class. Since case mappings are not always 1:1 char mappings, the resulting String may be a different length than the original String.

Examples of locale-sensitive and 1:M case mappings are in the following table.

<table class="plain"> <caption style="display:none">Examples of locale-sensitive and 1:M case mappings. Shows Language code of locale, lower case, upper case, and description.</caption> <thead> <tr> <th scope="col">Language Code of Locale</th> <th scope="col">Lower Case</th> <th scope="col">Upper Case</th> <th scope="col">Description</th> </tr> </thead> <tbody> <tr> <td>tr (Turkish)</td> <th scope="row" style="font-weight:normal; text-align:left">&#92;u0069</th> <td>&#92;u0130</td> <td>small letter i -&gt; capital letter I with dot above</td> </tr> <tr> <td>tr (Turkish)</td> <th scope="row" style="font-weight:normal; text-align:left">&#92;u0131</th> <td>&#92;u0049</td> <td>small letter dotless i -&gt; capital letter I</td> </tr> <tr> <td>(all)</td> <th scope="row" style="font-weight:normal; text-align:left">&#92;u00df</th> <td>&#92;u0053 &#92;u0053</td> <td>small letter sharp s -&gt; two letters: SS</td> </tr> <tr> <td>(all)</td> <th scope="row" style="font-weight:normal; text-align:left">Fahrvergn&uuml;gen</th> <td>FAHRVERGN&Uuml;GEN</td> <td></td> </tr> </tbody> </table>

Added in 1.1.

Java documentation for java.lang.String.toUpperCase(java.util.Locale).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to