How to convert a string to title case in Swift

1 Answer

0 votes
import Foundation

let str = "In the beginning there was nothing, which exploded."

let titleCaseString = str.capitalized

print(titleCaseString)  



/*
run:

In The Beginning There Was Nothing, Which Exploded.

*/

 



answered Apr 15, 2025 by avibootz
...