Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

uppercase
string
swift
communitycreator

What is the uppercased() function of a string in Swift?

Theodore Kelechukwu Onyejiaku

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Overview

The uppercased() method is used on a string instance to return the uppercase version of the string. It transforms a string to uppercase.

Syntax

string.uppercased()

Parameters

It doesn’t take any parameters.

Return value

The uppercase copy of the string instance string is returned.

Code example

// create some strings
let str1 = "Meta"
let str2 = "nft"
let str3 = "solidity"
let str4 = "blockchain"

// get uppercase version
print(str1.uppercased())
print(str2.uppercased())
print(str3.uppercased())
print(str4.uppercased())
Use of uppercased() method

Explanation

  • Line 2–5: We create some strings.
  • Line 8–11: We transform the strings to uppercase versions using the uppercased() function. Next, we print the results to the console.

RELATED TAGS

uppercase
string
swift
communitycreator

CONTRIBUTOR

Theodore Kelechukwu Onyejiaku

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring