Swift大寫和小寫字符串
大寫和小寫字符串(Uppercase and Lowercase Strings)
您可以通過字符串的uppercaseString
和lowercaseString
屬性來訪問大寫/小寫版本的字符串。
let normal = "Could you help me, please?"
let shouty = normal.uppercaseString
// shouty 值為 "COULD YOU HELP ME, PLEASE?"
let whispered = normal.lowercaseString
// whispered 值為 "could you help me, please?"