📚 开源资源分享——颜佐光的个人书架
✉️ 联系站长
书架 / Mac / swift

swift String to UTF8编码

2021-05-26 15:49 · 约 267 字 · 浏览 2,208 次 · 更新 2021-05-26 15:50swift

swift String to UTF8编码

var testString:String = "wo shi string"
var utf8String = (testString as NSString).UTF8String

iOS Swift 3.0 String encoding 转换

"你好".addingPercentEncoding(withAllowedCharacters: .urlHostAllowed)! 

说真的,这个方法我找了俩小时。

← 返回《Mac》目录书架 →