NEW: Master Swift design patterns with my latest book! >>

How to convert a string to lowercase letters

Written by Paul Hudson    @twostraws

You can convert any string to lowercase – that is, going from "HELLO" to "hello" – by calling its lowercased() method, like this:

let str = "Sunday, Monday, Happy Days"
print(str.lowercased())

That will output "sunday, monday, happy days" to the Xcode console.

Available from iOS 2.0

Did this solution work for you? Please pass it on!

Other people are reading…

About the Swift Knowledge Base

This is part of the Swift Knowledge Base, a free, searchable collection of solutions for common iOS questions.

Become a Swift guru

I wrote a book called Pro Swift that's dedicated to helping you master the Swift language, and it includes seven hours of video demonstrating each technique!

Click here to visit the Hacking with Swift store >>