Swift-字符串大小写转换

前端之家收集整理的这篇文章主要介绍了Swift-字符串大小写转换前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

Swift字符串大小写转换

uppercaseString 将字符串转成大写

lowercaseString 将字符串转成小写

capitalizedString 将字符串的首字母转成大写

let str01 = "Hi,how are you?"

let upperStr = str01.uppercaseString
// upperStr值为 "HI,HOW ARE YOU?"

let lowerStr = str01.lowercaseString
// lowerStr值为 "hi,how are you?"

let capitalStr = str01.capitalizedString
// capitalStr值为 "Hi,How Are You?"
原文链接:https://www.f2er.com/swift/325304.html

猜你在找的Swift相关文章