Swift .uppercaseString or .lowercaseString property replacement

前端 未结 5 1465
青春惊慌失措
青春惊慌失措 2021-02-01 12:39

Since Strings in Swift no longer have the .uppercaseString or .lowercaseString properties available, how would i go about performing that function?

If i have for example

5条回答
  •  情书的邮戳
    2021-02-01 13:08

    SwiftUI Solution

    The Solution in SwiftUI to uppercase a string

    Text("Hello World!".uppercased())
    

    The output would be: "HELLO WORLD!"


    To lowercase the string just use this

    Text("Hello World!".lowercased())
    

    The output would be: "hello world!"

提交回复
热议问题