Dart String toUpperCase() Function with Examples (original) (raw)

Last Updated : 07 Apr, 2025

The string **toUpperCase() method converts all characters of the string into an uppercase letter. The string **toUpperCase() function returns the string after converting all characters of the string into the uppercase letter.

**Syntax:

Str.toUpperCase()

**Image Representation:

Uppercase

**Example 1 :

Dart `

void main() {

// str1 stores the string "geeks"
String Str1 = "geeks"; 

// str2 stores the string "fOr GEeks"
String Str2 = "fOr GEeks"; 

// print str1 in uppercase letter
print(Str1.toUpperCase()); 

// print str2 in uppercase letter
print(Str2.toUpperCase()); 

}

`

**Output:

GEEKS
FOR GEEKS

**Example 2 :

Dart `

void main() {

// str1 stores the string "COMPUTER"
String Str1 = "COMPUTER"; 

// str2 stores the string "laPToP"
String Str2 = "laPToP"; 

// print str1 in uppercase letter
print(Str1.toUpperCase()); 

// print str2 in uppercase letter
print(Str2.toUpperCase()); 

}

`

**Output:

COMPUTER
LAPTOP

Similar Reads

Basics







Data Types








Control Flow





Key Functions







Object-Oriented Programming















Dart Utilities




Dart Programs










Advance Concepts