Library reference

Convert text to lowercase

Give these short labels the same letter case. All four inputs use plain English letters and digits.

lowercased

Simple example

Change the case of two letters.

Start'AB'
Resultab
main.swift
import Foundation

print("AB".lowercased())
Output
ab
Advertisements

Everyday examples

Make the bus label match the route board.

Start'BUS'
Resultbus
main.swift
import Foundation

print("BUS".lowercased())
Output
bus

Give an art shelf the same lettering as the other shelves.

Start'ART'
Resultart
main.swift
import Foundation

print("ART".lowercased())
Output
art

Normalize the letters in a ticket code and keep its digits.

Start'B12'
Resultb12
main.swift
import Foundation

print("B12".lowercased())
Output
b12
Run the example
Terminal
swift main.swift
Official documentation