位置:首页 > 高级语言 > Swift在线教程 > Swift大写和小写字符串

Swift大写和小写字符串

大写和小写字符串(Uppercase and Lowercase Strings)

您可以通过字符串的uppercaseStringlowercaseString属性来访问大写/小写版本的字符串。

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