- Reference
Definition
- Namespace:
- System
- Assembly:
- System.Runtime.dll
- Assembly:
- mscorlib.dll
- Assembly:
- netstandard.dll
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns a copy of this string converted to uppercase.
Overloads
ToUpper() | Returns a copy of this string converted to uppercase. |
ToUpper(CultureInfo) | Returns a copy of this string converted to uppercase, using the casing rules of the specified culture. |
ToUpper()
Returns a copy of this string converted to uppercase.
public: System::String ^ ToUpper();
public string ToUpper ();
member this.ToUpper : unit -> string
Public Function ToUpper () As String
Returns
- String
The uppercase equivalent of the current string.
Examples
The following example calls the ToUpper method to convert a series of one-character strings that contain each character in the Basic Latin, Latin-1 Supplement, and Latin Extended-A character sets. It then displays each string whose uppercase character is different from its lowercase character.
using namespace System;void main(){ int n = 0; for (int ctr = 0x20; ctr <= 0x017F; ctr++) { String^ string1 = Convert::ToChar(ctr).ToString(); String^ upperString = string1->ToUpper(); if (string1 != upperString) { Console::Write(L"{0} (\u+{1}) --> {2} (\u+{3}) ", string1, Convert::ToUInt16(string1[0]).ToString("X4"), upperString, Convert::ToUInt16(upperString[0]).ToString("X4")); n++; if (n % 2 == 0) Console::WriteLine(); } } }// The example displays the following output:// a (\u+0061) --> A (\u+0041) b (\u+0062) --> B (\u+0042)// c (\u+0063) --> C (\u+0043) d (\u+0064) --> D (\u+0044)// e (\u+0065) --> E (\u+0045) f (\u+0066) --> F (\u+0046)// g (\u+0067) --> G (\u+0047) h (\u+0068) --> H (\u+0048)// i (\u+0069) --> I (\u+0049) j (\u+006A) --> J (\u+004A)// k (\u+006B) --> K (\u+004B) l (\u+006C) --> L (\u+004C)// m (\u+006D) --> M (\u+004D) n (\u+006E) --> N (\u+004E)// o (\u+006F) --> O (\u+004F) p (\u+0070) --> P (\u+0050)// q (\u+0071) --> Q (\u+0051) r (\u+0072) --> R (\u+0052)// s (\u+0073) --> S (\u+0053) t (\u+0074) --> T (\u+0054)// u (\u+0075) --> U (\u+0055) v (\u+0076) --> V (\u+0056)// w (\u+0077) --> W (\u+0057) x (\u+0078) --> X (\u+0058)// y (\u+0079) --> Y (\u+0059) z (\u+007A) --> Z (\u+005A)// à (\u+00E0) --> À (\u+00C0) á (\u+00E1) --> Á (\u+00C1)// â (\u+00E2) -->  (\u+00C2) ã (\u+00E3) --> à (\u+00C3)// ä (\u+00E4) --> Ä (\u+00C4) å (\u+00E5) --> Å (\u+00C5)// æ (\u+00E6) --> Æ (\u+00C6) ç (\u+00E7) --> Ç (\u+00C7)// è (\u+00E8) --> È (\u+00C8) é (\u+00E9) --> É (\u+00C9)// ê (\u+00EA) --> Ê (\u+00CA) ë (\u+00EB) --> Ë (\u+00CB)// ì (\u+00EC) --> Ì (\u+00CC) í (\u+00ED) --> Í (\u+00CD)// î (\u+00EE) --> Î (\u+00CE) ï (\u+00EF) --> Ï (\u+00CF)// ð (\u+00F0) --> Ð (\u+00D0) ñ (\u+00F1) --> Ñ (\u+00D1)// ò (\u+00F2) --> Ò (\u+00D2) ó (\u+00F3) --> Ó (\u+00D3)// ô (\u+00F4) --> Ô (\u+00D4) õ (\u+00F5) --> Õ (\u+00D5)// ö (\u+00F6) --> Ö (\u+00D6) ø (\u+00F8) --> Ø (\u+00D8)// ù (\u+00F9) --> Ù (\u+00D9) ú (\u+00FA) --> Ú (\u+00DA)// û (\u+00FB) --> Û (\u+00DB) ü (\u+00FC) --> Ü (\u+00DC)// ý (\u+00FD) --> Ý (\u+00DD) þ (\u+00FE) --> Þ (\u+00DE)// ÿ (\u+00FF) --> Ÿ (\u+0178) ā (\u+0101) --> Ā (\u+0100)// ă (\u+0103) --> Ă (\u+0102) ą (\u+0105) --> Ą (\u+0104)// ć (\u+0107) --> Ć (\u+0106) ĉ (\u+0109) --> Ĉ (\u+0108)// ċ (\u+010B) --> Ċ (\u+010A) č (\u+010D) --> Č (\u+010C)// ď (\u+010F) --> Ď (\u+010E) đ (\u+0111) --> Đ (\u+0110)// ē (\u+0113) --> Ē (\u+0112) ĕ (\u+0115) --> Ĕ (\u+0114)// ė (\u+0117) --> Ė (\u+0116) ę (\u+0119) --> Ę (\u+0118)// ě (\u+011B) --> Ě (\u+011A) ĝ (\u+011D) --> Ĝ (\u+011C)// ğ (\u+011F) --> Ğ (\u+011E) ġ (\u+0121) --> Ġ (\u+0120)// ģ (\u+0123) --> Ģ (\u+0122) ĥ (\u+0125) --> Ĥ (\u+0124)// ħ (\u+0127) --> Ħ (\u+0126) ĩ (\u+0129) --> Ĩ (\u+0128)// ī (\u+012B) --> Ī (\u+012A) ĭ (\u+012D) --> Ĭ (\u+012C)// į (\u+012F) --> Į (\u+012E) ı (\u+0131) --> I (\u+0049)// ij (\u+0133) --> IJ (\u+0132) ĵ (\u+0135) --> Ĵ (\u+0134)// ķ (\u+0137) --> Ķ (\u+0136) ĺ (\u+013A) --> Ĺ (\u+0139)// ļ (\u+013C) --> Ļ (\u+013B) ľ (\u+013E) --> Ľ (\u+013D)// ŀ (\u+0140) --> Ŀ (\u+013F) ł (\u+0142) --> Ł (\u+0141)// ń (\u+0144) --> Ń (\u+0143) ņ (\u+0146) --> Ņ (\u+0145)// ň (\u+0148) --> Ň (\u+0147) ŋ (\u+014B) --> Ŋ (\u+014A)// ō (\u+014D) --> Ō (\u+014C) ŏ (\u+014F) --> Ŏ (\u+014E)// ő (\u+0151) --> Ő (\u+0150) œ (\u+0153) --> Œ (\u+0152)// ŕ (\u+0155) --> Ŕ (\u+0154) ŗ (\u+0157) --> Ŗ (\u+0156)// ř (\u+0159) --> Ř (\u+0158) ś (\u+015B) --> Ś (\u+015A)// ŝ (\u+015D) --> Ŝ (\u+015C) ş (\u+015F) --> Ş (\u+015E)// š (\u+0161) --> Š (\u+0160) ţ (\u+0163) --> Ţ (\u+0162)// ť (\u+0165) --> Ť (\u+0164) ŧ (\u+0167) --> Ŧ (\u+0166)// ũ (\u+0169) --> Ũ (\u+0168) ū (\u+016B) --> Ū (\u+016A)// ŭ (\u+016D) --> Ŭ (\u+016C) ů (\u+016F) --> Ů (\u+016E)// ű (\u+0171) --> Ű (\u+0170) ų (\u+0173) --> Ų (\u+0172)// ŵ (\u+0175) --> Ŵ (\u+0174) ŷ (\u+0177) --> Ŷ (\u+0176)// ź (\u+017A) --> Ź (\u+0179) ż (\u+017C) --> Ż (\u+017B)// ž (\u+017E) --> Ž (\u+017D)
using System;public class Example{ public static void Main() { int n = 0; for (int ctr = 0x20; ctr <= 0x017F; ctr++) { string string1 = ((char)ctr).ToString(); string upperString = string1.ToUpper(); if (string1 != upperString) { Console.Write(@"{0} (\u+{1}) --> {2} (\u+{3}) ", string1, Convert.ToUInt16(string1[0]).ToString("X4"), upperString, Convert.ToUInt16(upperString[0]).ToString("X4")); n++; if (n % 2 == 0) Console.WriteLine(); } } }}// The example displays the following output:// a (\u+0061) --> A (\u+0041) b (\u+0062) --> B (\u+0042)// c (\u+0063) --> C (\u+0043) d (\u+0064) --> D (\u+0044)// e (\u+0065) --> E (\u+0045) f (\u+0066) --> F (\u+0046)// g (\u+0067) --> G (\u+0047) h (\u+0068) --> H (\u+0048)// i (\u+0069) --> I (\u+0049) j (\u+006A) --> J (\u+004A)// k (\u+006B) --> K (\u+004B) l (\u+006C) --> L (\u+004C)// m (\u+006D) --> M (\u+004D) n (\u+006E) --> N (\u+004E)// o (\u+006F) --> O (\u+004F) p (\u+0070) --> P (\u+0050)// q (\u+0071) --> Q (\u+0051) r (\u+0072) --> R (\u+0052)// s (\u+0073) --> S (\u+0053) t (\u+0074) --> T (\u+0054)// u (\u+0075) --> U (\u+0055) v (\u+0076) --> V (\u+0056)// w (\u+0077) --> W (\u+0057) x (\u+0078) --> X (\u+0058)// y (\u+0079) --> Y (\u+0059) z (\u+007A) --> Z (\u+005A)// à (\u+00E0) --> À (\u+00C0) á (\u+00E1) --> Á (\u+00C1)// â (\u+00E2) -->  (\u+00C2) ã (\u+00E3) --> à (\u+00C3)// ä (\u+00E4) --> Ä (\u+00C4) å (\u+00E5) --> Å (\u+00C5)// æ (\u+00E6) --> Æ (\u+00C6) ç (\u+00E7) --> Ç (\u+00C7)// è (\u+00E8) --> È (\u+00C8) é (\u+00E9) --> É (\u+00C9)// ê (\u+00EA) --> Ê (\u+00CA) ë (\u+00EB) --> Ë (\u+00CB)// ì (\u+00EC) --> Ì (\u+00CC) í (\u+00ED) --> Í (\u+00CD)// î (\u+00EE) --> Î (\u+00CE) ï (\u+00EF) --> Ï (\u+00CF)// ð (\u+00F0) --> Ð (\u+00D0) ñ (\u+00F1) --> Ñ (\u+00D1)// ò (\u+00F2) --> Ò (\u+00D2) ó (\u+00F3) --> Ó (\u+00D3)// ô (\u+00F4) --> Ô (\u+00D4) õ (\u+00F5) --> Õ (\u+00D5)// ö (\u+00F6) --> Ö (\u+00D6) ø (\u+00F8) --> Ø (\u+00D8)// ù (\u+00F9) --> Ù (\u+00D9) ú (\u+00FA) --> Ú (\u+00DA)// û (\u+00FB) --> Û (\u+00DB) ü (\u+00FC) --> Ü (\u+00DC)// ý (\u+00FD) --> Ý (\u+00DD) þ (\u+00FE) --> Þ (\u+00DE)// ÿ (\u+00FF) --> Ÿ (\u+0178) ā (\u+0101) --> Ā (\u+0100)// ă (\u+0103) --> Ă (\u+0102) ą (\u+0105) --> Ą (\u+0104)// ć (\u+0107) --> Ć (\u+0106) ĉ (\u+0109) --> Ĉ (\u+0108)// ċ (\u+010B) --> Ċ (\u+010A) č (\u+010D) --> Č (\u+010C)// ď (\u+010F) --> Ď (\u+010E) đ (\u+0111) --> Đ (\u+0110)// ē (\u+0113) --> Ē (\u+0112) ĕ (\u+0115) --> Ĕ (\u+0114)// ė (\u+0117) --> Ė (\u+0116) ę (\u+0119) --> Ę (\u+0118)// ě (\u+011B) --> Ě (\u+011A) ĝ (\u+011D) --> Ĝ (\u+011C)// ğ (\u+011F) --> Ğ (\u+011E) ġ (\u+0121) --> Ġ (\u+0120)// ģ (\u+0123) --> Ģ (\u+0122) ĥ (\u+0125) --> Ĥ (\u+0124)// ħ (\u+0127) --> Ħ (\u+0126) ĩ (\u+0129) --> Ĩ (\u+0128)// ī (\u+012B) --> Ī (\u+012A) ĭ (\u+012D) --> Ĭ (\u+012C)// į (\u+012F) --> Į (\u+012E) ı (\u+0131) --> I (\u+0049)// ij (\u+0133) --> IJ (\u+0132) ĵ (\u+0135) --> Ĵ (\u+0134)// ķ (\u+0137) --> Ķ (\u+0136) ĺ (\u+013A) --> Ĺ (\u+0139)// ļ (\u+013C) --> Ļ (\u+013B) ľ (\u+013E) --> Ľ (\u+013D)// ŀ (\u+0140) --> Ŀ (\u+013F) ł (\u+0142) --> Ł (\u+0141)// ń (\u+0144) --> Ń (\u+0143) ņ (\u+0146) --> Ņ (\u+0145)// ň (\u+0148) --> Ň (\u+0147) ŋ (\u+014B) --> Ŋ (\u+014A)// ō (\u+014D) --> Ō (\u+014C) ŏ (\u+014F) --> Ŏ (\u+014E)// ő (\u+0151) --> Ő (\u+0150) œ (\u+0153) --> Œ (\u+0152)// ŕ (\u+0155) --> Ŕ (\u+0154) ŗ (\u+0157) --> Ŗ (\u+0156)// ř (\u+0159) --> Ř (\u+0158) ś (\u+015B) --> Ś (\u+015A)// ŝ (\u+015D) --> Ŝ (\u+015C) ş (\u+015F) --> Ş (\u+015E)// š (\u+0161) --> Š (\u+0160) ţ (\u+0163) --> Ţ (\u+0162)// ť (\u+0165) --> Ť (\u+0164) ŧ (\u+0167) --> Ŧ (\u+0166)// ũ (\u+0169) --> Ũ (\u+0168) ū (\u+016B) --> Ū (\u+016A)// ŭ (\u+016D) --> Ŭ (\u+016C) ů (\u+016F) --> Ů (\u+016E)// ű (\u+0171) --> Ű (\u+0170) ų (\u+0173) --> Ų (\u+0172)// ŵ (\u+0175) --> Ŵ (\u+0174) ŷ (\u+0177) --> Ŷ (\u+0176)// ź (\u+017A) --> Ź (\u+0179) ż (\u+017C) --> Ż (\u+017B)// ž (\u+017E) --> Ž (\u+017D)
open Systemlet mutable n = 0for i = 0x20 to 0x017F do let string1 = (char i).ToString() let upperString = string1.ToUpper() if string1 <> upperString then printf $"""{string1} (\u+{Convert.ToUInt16(string1[0]).ToString "X4"}) --> {upperString} (\u+{Convert.ToUInt16(upperString[0]).ToString("X4")}) """ n <- n + 1 if n % 2 = 0 then printfn ""// The example displays the following output:// a (\u+0061) --> A (\u+0041) b (\u+0062) --> B (\u+0042)// c (\u+0063) --> C (\u+0043) d (\u+0064) --> D (\u+0044)// e (\u+0065) --> E (\u+0045) f (\u+0066) --> F (\u+0046)// g (\u+0067) --> G (\u+0047) h (\u+0068) --> H (\u+0048)// i (\u+0069) --> I (\u+0049) j (\u+006A) --> J (\u+004A)// k (\u+006B) --> K (\u+004B) l (\u+006C) --> L (\u+004C)// m (\u+006D) --> M (\u+004D) n (\u+006E) --> N (\u+004E)// o (\u+006F) --> O (\u+004F) p (\u+0070) --> P (\u+0050)// q (\u+0071) --> Q (\u+0051) r (\u+0072) --> R (\u+0052)// s (\u+0073) --> S (\u+0053) t (\u+0074) --> T (\u+0054)// u (\u+0075) --> U (\u+0055) v (\u+0076) --> V (\u+0056)// w (\u+0077) --> W (\u+0057) x (\u+0078) --> X (\u+0058)// y (\u+0079) --> Y (\u+0059) z (\u+007A) --> Z (\u+005A)// à (\u+00E0) --> À (\u+00C0) á (\u+00E1) --> Á (\u+00C1)// â (\u+00E2) -->  (\u+00C2) ã (\u+00E3) --> à (\u+00C3)// ä (\u+00E4) --> Ä (\u+00C4) å (\u+00E5) --> Å (\u+00C5)// æ (\u+00E6) --> Æ (\u+00C6) ç (\u+00E7) --> Ç (\u+00C7)// è (\u+00E8) --> È (\u+00C8) é (\u+00E9) --> É (\u+00C9)// ê (\u+00EA) --> Ê (\u+00CA) ë (\u+00EB) --> Ë (\u+00CB)// ì (\u+00EC) --> Ì (\u+00CC) í (\u+00ED) --> Í (\u+00CD)// î (\u+00EE) --> Î (\u+00CE) ï (\u+00EF) --> Ï (\u+00CF)// ð (\u+00F0) --> Ð (\u+00D0) ñ (\u+00F1) --> Ñ (\u+00D1)// ò (\u+00F2) --> Ò (\u+00D2) ó (\u+00F3) --> Ó (\u+00D3)// ô (\u+00F4) --> Ô (\u+00D4) õ (\u+00F5) --> Õ (\u+00D5)// ö (\u+00F6) --> Ö (\u+00D6) ø (\u+00F8) --> Ø (\u+00D8)// ù (\u+00F9) --> Ù (\u+00D9) ú (\u+00FA) --> Ú (\u+00DA)// û (\u+00FB) --> Û (\u+00DB) ü (\u+00FC) --> Ü (\u+00DC)// ý (\u+00FD) --> Ý (\u+00DD) þ (\u+00FE) --> Þ (\u+00DE)// ÿ (\u+00FF) --> Ÿ (\u+0178) ā (\u+0101) --> Ā (\u+0100)// ă (\u+0103) --> Ă (\u+0102) ą (\u+0105) --> Ą (\u+0104)// ć (\u+0107) --> Ć (\u+0106) ĉ (\u+0109) --> Ĉ (\u+0108)// ċ (\u+010B) --> Ċ (\u+010A) č (\u+010D) --> Č (\u+010C)// ď (\u+010F) --> Ď (\u+010E) đ (\u+0111) --> Đ (\u+0110)// ē (\u+0113) --> Ē (\u+0112) ĕ (\u+0115) --> Ĕ (\u+0114)// ė (\u+0117) --> Ė (\u+0116) ę (\u+0119) --> Ę (\u+0118)// ě (\u+011B) --> Ě (\u+011A) ĝ (\u+011D) --> Ĝ (\u+011C)// ğ (\u+011F) --> Ğ (\u+011E) ġ (\u+0121) --> Ġ (\u+0120)// ģ (\u+0123) --> Ģ (\u+0122) ĥ (\u+0125) --> Ĥ (\u+0124)// ħ (\u+0127) --> Ħ (\u+0126) ĩ (\u+0129) --> Ĩ (\u+0128)// ī (\u+012B) --> Ī (\u+012A) ĭ (\u+012D) --> Ĭ (\u+012C)// į (\u+012F) --> Į (\u+012E) ı (\u+0131) --> I (\u+0049)// ij (\u+0133) --> IJ (\u+0132) ĵ (\u+0135) --> Ĵ (\u+0134)// ķ (\u+0137) --> Ķ (\u+0136) ĺ (\u+013A) --> Ĺ (\u+0139)// ļ (\u+013C) --> Ļ (\u+013B) ľ (\u+013E) --> Ľ (\u+013D)// ŀ (\u+0140) --> Ŀ (\u+013F) ł (\u+0142) --> Ł (\u+0141)// ń (\u+0144) --> Ń (\u+0143) ņ (\u+0146) --> Ņ (\u+0145)// ň (\u+0148) --> Ň (\u+0147) ŋ (\u+014B) --> Ŋ (\u+014A)// ō (\u+014D) --> Ō (\u+014C) ŏ (\u+014F) --> Ŏ (\u+014E)// ő (\u+0151) --> Ő (\u+0150) œ (\u+0153) --> Œ (\u+0152)// ŕ (\u+0155) --> Ŕ (\u+0154) ŗ (\u+0157) --> Ŗ (\u+0156)// ř (\u+0159) --> Ř (\u+0158) ś (\u+015B) --> Ś (\u+015A)// ŝ (\u+015D) --> Ŝ (\u+015C) ş (\u+015F) --> Ş (\u+015E)// š (\u+0161) --> Š (\u+0160) ţ (\u+0163) --> Ţ (\u+0162)// ť (\u+0165) --> Ť (\u+0164) ŧ (\u+0167) --> Ŧ (\u+0166)// ũ (\u+0169) --> Ũ (\u+0168) ū (\u+016B) --> Ū (\u+016A)// ŭ (\u+016D) --> Ŭ (\u+016C) ů (\u+016F) --> Ů (\u+016E)// ű (\u+0171) --> Ű (\u+0170) ų (\u+0173) --> Ų (\u+0172)// ŵ (\u+0175) --> Ŵ (\u+0174) ŷ (\u+0177) --> Ŷ (\u+0176)// ź (\u+017A) --> Ź (\u+0179) ż (\u+017C) --> Ż (\u+017B)// ž (\u+017E) --> Ž (\u+017D)
Module Example Public Sub Main() Dim n As Integer = 0 For ctr As Integer = &h20 To &h017F Dim string1 As String = ChrW(ctr).ToString() Dim upperString As String = string1.ToUpper() If string1 <> upperString Then Console.Write("{0} (\u+{1}) --> {2} (\u+{3}) ", _ string1, _ Convert.ToUInt16(string1.Chars(0)).ToString("X4"), _ upperString, _ Convert.ToUInt16(upperString.Chars(0)).ToString("X4")) n += 1 If n Mod 2 = 0 Then Console.WriteLine() End If Next End SubEnd Module' The example displays the following output:' a (\u+0061) --> A (\u+0041) b (\u+0062) --> B (\u+0042)' c (\u+0063) --> C (\u+0043) d (\u+0064) --> D (\u+0044)' e (\u+0065) --> E (\u+0045) f (\u+0066) --> F (\u+0046)' g (\u+0067) --> G (\u+0047) h (\u+0068) --> H (\u+0048)' i (\u+0069) --> I (\u+0049) j (\u+006A) --> J (\u+004A)' k (\u+006B) --> K (\u+004B) l (\u+006C) --> L (\u+004C)' m (\u+006D) --> M (\u+004D) n (\u+006E) --> N (\u+004E)' o (\u+006F) --> O (\u+004F) p (\u+0070) --> P (\u+0050)' q (\u+0071) --> Q (\u+0051) r (\u+0072) --> R (\u+0052)' s (\u+0073) --> S (\u+0053) t (\u+0074) --> T (\u+0054)' u (\u+0075) --> U (\u+0055) v (\u+0076) --> V (\u+0056)' w (\u+0077) --> W (\u+0057) x (\u+0078) --> X (\u+0058)' y (\u+0079) --> Y (\u+0059) z (\u+007A) --> Z (\u+005A)' à (\u+00E0) --> À (\u+00C0) á (\u+00E1) --> Á (\u+00C1)' â (\u+00E2) -->  (\u+00C2) ã (\u+00E3) --> à (\u+00C3)' ä (\u+00E4) --> Ä (\u+00C4) å (\u+00E5) --> Å (\u+00C5)' æ (\u+00E6) --> Æ (\u+00C6) ç (\u+00E7) --> Ç (\u+00C7)' è (\u+00E8) --> È (\u+00C8) é (\u+00E9) --> É (\u+00C9)' ê (\u+00EA) --> Ê (\u+00CA) ë (\u+00EB) --> Ë (\u+00CB)' ì (\u+00EC) --> Ì (\u+00CC) í (\u+00ED) --> Í (\u+00CD)' î (\u+00EE) --> Î (\u+00CE) ï (\u+00EF) --> Ï (\u+00CF)' ð (\u+00F0) --> Ð (\u+00D0) ñ (\u+00F1) --> Ñ (\u+00D1)' ò (\u+00F2) --> Ò (\u+00D2) ó (\u+00F3) --> Ó (\u+00D3)' ô (\u+00F4) --> Ô (\u+00D4) õ (\u+00F5) --> Õ (\u+00D5)' ö (\u+00F6) --> Ö (\u+00D6) ø (\u+00F8) --> Ø (\u+00D8)' ù (\u+00F9) --> Ù (\u+00D9) ú (\u+00FA) --> Ú (\u+00DA)' û (\u+00FB) --> Û (\u+00DB) ü (\u+00FC) --> Ü (\u+00DC)' ý (\u+00FD) --> Ý (\u+00DD) þ (\u+00FE) --> Þ (\u+00DE)' ÿ (\u+00FF) --> Ÿ (\u+0178) ā (\u+0101) --> Ā (\u+0100)' ă (\u+0103) --> Ă (\u+0102) ą (\u+0105) --> Ą (\u+0104)' ć (\u+0107) --> Ć (\u+0106) ĉ (\u+0109) --> Ĉ (\u+0108)' ċ (\u+010B) --> Ċ (\u+010A) č (\u+010D) --> Č (\u+010C)' ď (\u+010F) --> Ď (\u+010E) đ (\u+0111) --> Đ (\u+0110)' ē (\u+0113) --> Ē (\u+0112) ĕ (\u+0115) --> Ĕ (\u+0114)' ė (\u+0117) --> Ė (\u+0116) ę (\u+0119) --> Ę (\u+0118)' ě (\u+011B) --> Ě (\u+011A) ĝ (\u+011D) --> Ĝ (\u+011C)' ğ (\u+011F) --> Ğ (\u+011E) ġ (\u+0121) --> Ġ (\u+0120)' ģ (\u+0123) --> Ģ (\u+0122) ĥ (\u+0125) --> Ĥ (\u+0124)' ħ (\u+0127) --> Ħ (\u+0126) ĩ (\u+0129) --> Ĩ (\u+0128)' ī (\u+012B) --> Ī (\u+012A) ĭ (\u+012D) --> Ĭ (\u+012C)' į (\u+012F) --> Į (\u+012E) ı (\u+0131) --> I (\u+0049)' ij (\u+0133) --> IJ (\u+0132) ĵ (\u+0135) --> Ĵ (\u+0134)' ķ (\u+0137) --> Ķ (\u+0136) ĺ (\u+013A) --> Ĺ (\u+0139)' ļ (\u+013C) --> Ļ (\u+013B) ľ (\u+013E) --> Ľ (\u+013D)' ŀ (\u+0140) --> Ŀ (\u+013F) ł (\u+0142) --> Ł (\u+0141)' ń (\u+0144) --> Ń (\u+0143) ņ (\u+0146) --> Ņ (\u+0145)' ň (\u+0148) --> Ň (\u+0147) ŋ (\u+014B) --> Ŋ (\u+014A)' ō (\u+014D) --> Ō (\u+014C) ŏ (\u+014F) --> Ŏ (\u+014E)' ő (\u+0151) --> Ő (\u+0150) œ (\u+0153) --> Œ (\u+0152)' ŕ (\u+0155) --> Ŕ (\u+0154) ŗ (\u+0157) --> Ŗ (\u+0156)' ř (\u+0159) --> Ř (\u+0158) ś (\u+015B) --> Ś (\u+015A)' ŝ (\u+015D) --> Ŝ (\u+015C) ş (\u+015F) --> Ş (\u+015E)' š (\u+0161) --> Š (\u+0160) ţ (\u+0163) --> Ţ (\u+0162)' ť (\u+0165) --> Ť (\u+0164) ŧ (\u+0167) --> Ŧ (\u+0166)' ũ (\u+0169) --> Ũ (\u+0168) ū (\u+016B) --> Ū (\u+016A)' ŭ (\u+016D) --> Ŭ (\u+016C) ů (\u+016F) --> Ů (\u+016E)' ű (\u+0171) --> Ű (\u+0170) ų (\u+0173) --> Ų (\u+0172)' ŵ (\u+0175) --> Ŵ (\u+0174) ŷ (\u+0177) --> Ŷ (\u+0176)' ź (\u+017A) --> Ź (\u+0179) ż (\u+017C) --> Ż (\u+017B)' ž (\u+017E) --> Ž (\u+017D)
Remarks
This method uses the casing rules of the current culture to convert each character in the current instance to its uppercase equivalent. If a character does not have an uppercase equivalent, it is included unchanged in the returned string.
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 uppercase.
The ToUpper method is often used to convert a string to uppercase so that it can be used in a case-insensitive comparison. A better method to perform case-insensitive comparison is to call a string comparison method that has a StringComparison parameter whose value you set to StringComparison.CurrentCultureIgnoreCase for a culture-sensitive, case-insensitive comparison.
Security Considerations
The casing operation that results from calling the ToUpper() 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 method. This produces the same result in every culture (unlike the ToUpper() method) and performs more efficiently.
Notes to Callers
As 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 string to uppercase by using the casing conventions of the current culture, call the ToUpper(CultureInfo) method overload with a value of CurrentCulture for its culture
parameter.
See also
- ToLower()
- ToLowerInvariant()
- ToUpperInvariant()
Applies to
ToUpper(CultureInfo)
Returns a copy of this string converted to uppercase, using the casing rules of the specified culture.
public: System::String ^ ToUpper(System::Globalization::CultureInfo ^ culture);
public string ToUpper (System.Globalization.CultureInfo? culture);
public string ToUpper (System.Globalization.CultureInfo culture);
member this.ToUpper : System.Globalization.CultureInfo -> string
Public Function ToUpper (culture As CultureInfo) As String
Parameters
- culture
- CultureInfo
An object that supplies culture-specific casing rules. If culture
is null
, the current culture is used.
Returns
- String
The uppercase equivalent of the current string.
Examples
The following example converts a string of lowercase characters to two strings of uppercase characters using the English-United States and Turkish-Turkey cultures, then compares the uppercase 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.
using System;using System.Globalization;class Example{ public static void Main() { string str1 = "indigo"; string str2, str3; // str2 is an uppercase copy of str1, using English-United States culture. str2 = str1.ToUpper(new CultureInfo("en-US", false)); // str3 is an uppercase copy of str1, using Turkish-Turkey culture. str3 = str1.ToUpper(new CultureInfo("tr-TR", false)); // Compare the code points and compare the uppercase strings. ShowCodePoints("str1", str1); ShowCodePoints("str2", str2); ShowCodePoints("str3", str3); Console.WriteLine("str2 is {0} to str3.", String.CompareOrdinal(str2, str3) == 0 ? "equal" : "not equal"); } public static void ShowCodePoints(string varName, string s) { Console.Write("{0} = {1}: ", varName, s); foreach (ushort u in s) Console.Write("{0:x4} ", u); Console.WriteLine(); }}// This example displays the following output:// str1 = indigo: 0069 006e 0064 0069 0067 006f// str2 = INDIGO: 0049 004e 0044 0049 0047 004f// str3 = İNDİGO: 0130 004e 0044 0130 0047 004f// str2 is not equal to str3.
open Systemopen System.Globalizationlet str1 = "indigo"let showCodePoints varName s = printf $"%s{varName} = %s{s}: " for u in s do printf $"{uint16 u:x4} " printfn ""// str2 is an uppercase copy of str1, using English-United States culture.let str2 = str1.ToUpper(CultureInfo("en-US", false))// str3 is an uppercase copy of str1, using Turkish-Turkey culture.let str3 = str1.ToUpper(CultureInfo("tr-TR", false))// Compare the code points and compare the uppercase strings.showCodePoints "str2" str2showCodePoints "str1" str1showCodePoints "str3" str3printfn $"""str2 is {if String.CompareOrdinal(str2, str3) = 0 then "equal" else "not equal"} to str3."""// This example displays the following output:// str1 = indigo: 0069 006e 0064 0069 0067 006f// str2 = INDIGO: 0049 004e 0044 0049 0047 004f// str3 = İNDİGO: 0130 004e 0044 0130 0047 004f// str2 is not equal to str3.
Imports System.GlobalizationPublic Module Example Public Sub Main() Dim str1 As String = "indigo" Dim str2, str3 As String ' str2 is an uppercase copy of str1, using English-United States culture. str2 = str1.ToUpper(New CultureInfo("en-US", False)) ' str3 is an uppercase copy of str1, using Turkish-Turkey culture. str3 = str1.ToUpper(New CultureInfo("tr-TR", False)) ' Compare the code points and compare the uppercase strings. ShowCodePoints("str1", str1) ShowCodePoints("str2", str2) ShowCodePoints("str3", str3) Console.WriteLine("str2 is {0} to str3.", _ IIf(String.CompareOrdinal(str2, str3) = 0, "equal", "not equal")) End Sub Public Sub ShowCodePoints(varName As String, s As String) Console.Write("{0} = {1}: ", varName, s) For Each c In s Console.Write("{0:X4} ", AscW(c)) Next Console.WriteLine() End Sub End Module' The example displays the following output:' str1 = indigo: 0069 006E 0064 0069 0067 006F' str2 = INDIGO: 0049 004E 0044 0049 0047 004F' str3 = İNDİGO: 0130 004E 0044 0130 0047 004F' str2 is not equal to str3.
Remarks
The casing rules of the culture specified by the culture
parameter determine the way the case of a string is changed.
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 uppercase.
Security Considerations
If you pass the ToUpper(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
- ToLower()
- ToLowerInvariant()
- ToUpperInvariant()
Applies to
FAQs
Does Toupper work on strings? ›
C++ String has got built-in toupper() function to convert the input String to Uppercase. In the above snippet of code, the cstring package contains the String related functions.
What does the string method toUpperCase () method do? ›Java String toUpperCase() Method
The toUpperCase() method converts a string to upper case letters. Note: The toLowerCase() method converts a string to lower case letters.
C# | ToUpper() Method
In C#, ToUpper() is a string method. It converts every characters to uppercase (if there is an uppercase version). If a character does not have an uppercase equivalent, it remains unchanged.
ToUpper depends on what your strings contain more of, and that typically strings contain more lower case characters which makes ToLower more efficient.
How do I convert a character to a string uppercase? ›Transform a String to Uppercase
If you need your string in uppercase, you can use the toUpperCase() method available on strings. This method returns the string with all its characters in uppercase.
The isuppercase( ) method is used to check whether the given character is in upper case or not. It returns a Boolean data type. The toUpperCase( ) method is used to convert a character or string into upper case. It returns char or String type.
How to convert list of string to uppercase in Java? ›Java String to uppercase conversion can be done using toUpperCase() method.
How to convert first letter of string to uppercase in Java? ›- String s = "javatpoint";
- String s1 = str.substring(0, 1).toUpperCase(); // first letter = J.
- String s2 = str.substring(1); // after 1st letter = avatpoint.
- String res = str.substring(0, 1).toUpperCase() + str.substring(1); // J + avatpoint.
To use the . toUpperCase() method, assign the string you want to change to uppercase to a variable and then prepend it with . toUpperCase() .
How do I convert a lowercase string to uppercase? ›Java String toLowerCase() Method
The toLowerCase() method converts a string to lower case letters. Note: The toUpperCase() method converts a string to upper case letters.
How to convert a lowercase character to uppercase in C#? ›
To convert a character to uppercase by using the casing conventions of the current culture, call the ToUpper(Char, CultureInfo) method overload with a value of CurrentCulture for its culture parameter.
How to convert first letter of string to uppercase in C#? ›- In C#, the Toupper() function of the char class converts a character into uppercase. ...
- The first character of the string can be indexed as str[0] , where str is the original string. ...
- Code.
It's faster and easier to type in lowercase, so when it's valuable to be quick and natural (or to seem that way), like on IM, lowercase is often the default. Messages typed all in lowercase can feel more offhand. The stakes feel lower, the vibe is calm.
Which header file is used for toupper? ›The toupper() function is defined in the <ctype. h> header file.
Does toUpperCase change the original string? ›The toUpperCase() method converts a string to uppercase letters. The toUpperCase() method does not change the original string.
Does toUpperCase work on characters? ›The toUpperCase() method is a static method in the Character class in Java that converts a character to uppercase. The input for this function is a character. If you need to convert a string to uppercase, refer to the String.
What is the formula for converting text into uppercase? ›Tip: Use the formula =UPPER(A1) for all UPPERCASE; =LOWER(A1) for all lowercase. Now fill down the formula through cell B10.
How do I change text to uppercase without retyping? ›Look for the “Change Case” button on the Ribbon or use keyboard shortcuts after selecting text. In Word and Outlook for Windows hold SHIFT + F3 (tap to cycle) until the case you want is applied (if you have a laptop you may also need to hold the FN key).
Does toUpperCase change the variable? ›The toUpperCase method returns the value of the string converted to uppercase. toUpperCase does not affect the value of the string itself.
Does toUpperCase create a new object? ›toUpperCase() calls toUpperCase(Locale. getDefault()) , which creates a new String object only if it has to. If the input String is already in upper case, it returns the input String .
Why do we use toupper in C++? ›
The toupper() function is used to convert lowercase alphabet to uppercase. i.e. If the character passed is a lowercase alphabet then the toupper() function converts a lowercase alphabet to an uppercase alphabet. It is defined in the ctype. h header file.
How to use uppercase method in Java? ›- public class StringUpperExample{
- public static void main(String args[]){
- String s1="hello string";
- String s1upper=s1.toUpperCase();
- System.out.println(s1upper);
- }}
with upper()
In this approach we directly apply the upper() to the list through a for loop. So each string gets converted to uppercase letters.
To check whether a character is in Uppercase or not in Java, use the Character. isUpperCase() method.
How to convert first letter of string to lowercase in Java? ›...
- More specifically, the method uncapitalize(java. ...
- Not necessarily the most efficient, but perhaps the clearest, which counts for a lot.
Using isupper() method
One way to achieve this is using the inbuilt string method isupper(). We should access the first letter of the string using indexing and then send the character to isupper() method, this method returns True if the given character is Capital otherwise, it returns False.
- By using replace() function.
- By using For loop to titlecase a string.
- By using map() method.
- By using reduce() method.
log("--" + alpha()); Just get the ascii code for each char, and if it ranges between 97 to 122 ( a to z ) deduct 32 from val to get the corresponding upper case char.
How do I convert text to uppercase in CSS? ›To convert text to uppercase with CSS, use the text-transform property with value uppercase.
What converts all letters in a text string to lowercase? ›Converts all uppercase letters in a text string to lowercase.
What method can you use to change a string from lowercase text to uppercase text in PowerShell? ›
The Complete PowerShell 7 course: Beginner To Advanced
To convert the content of the file into the upper case, you need to use the method ToUpper() and to convert into lower case, you need to use ToLower() method.
- If the ASCII value lies in the range of [65, 90], then it is an uppercase letter.
- If the ASCII value lies in the range of [97, 122], then it is a lowercase letter.
- If the ASCII value lies in the range of [48, 57], then it is a number.
toUpperCase() method returns a new string and does not alter the original string in any way. To convert an entire string or just the first character of each word in a string to uppercase, use the JavaScript toUpperCase() method.
How do you upper a string in Python? ›The upper() method returns a string where all characters are in upper case. Symbols and Numbers are ignored.
What are the 5 rules of capitalization? ›- Capitalize the first word of a sentence. ...
- Capitalize names and other proper nouns. ...
- Don't capitalize after a colon (usually) ...
- Capitalize the first word of a quote (sometimes) ...
- Capitalize days, months, and holidays, but not seasons. ...
- Capitalize most words in titles.
- Capitalize the first word in a sentence. This is an easy one that is pretty consistent across languages with Latin-based alphabets.
- Capitalize the pronoun 'I' in any location. Remember that you are important! ...
- Capitalize all proper nouns.
- Capitalize the first word of a sentence. ...
- Capitalize proper nouns. ...
- Capitalize time periods and events* ...
- Capitalize job titles. ...
- Capitalize days, months, and holidays. ...
- Sometimes capitalize after a colon. ...
- Capitalize the first word of a quote.