Swift String uppercased()

The uppercased() method converts all lowercase characters in a string into uppercase characters.

Example


uppercased() Syntax

The syntax of uppercased() method is:

string.uppercased()

Here, string is an object of the String class.


uppercased() Parameters

uppercased() method doesn't take any parameters.


uppercased() Return Value

returns the given string in uppercase.


Example 1: Swift uppercased()

Output

THIS SHOULD BE UPPERCASE!
TH!S SH0ULD B3 UPP3RCAS3!

Example 2: Compare Two Strings Using uppercased()

Output

The strings are same.