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?"