Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

lowercase
string
swift
communitycreator

What is the lowercased() method 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 lowercased() method of a string instance in Swift is used to return a lowercase copy of a string.

Syntax

string.lowercased()

Parameters

There are no parameters for this method.

Return value

The lowercase version of the string is returned.

Code example

// create some strings
let str1 = "Edpresso is the Best"
let str2 = "Best PLACE TO BE"
let str3 = "Learn all YOU need"
// get the lowwer case versions
print(str1.lowercased())
print(str2.lowercased())
print(str3.lowercased())
How to get the lowercase version of a string in Swift

Explanation

  • Lines 2–4: We created some strings.
  • Lines 7–9: The lowercase versions of the strings were obtained using the lowercased() method. The results were printed to the console.

RELATED TAGS

lowercase
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