func getStringByteLength(string:String) ->Int{
var bytes: [UInt8] = []
for char in string.utf8{
//print("char:\(char)")
bytes.append(char.advanced(by:0))
}
print("\(string)长度:\(bytes.count)")
return bytes.count
}
//一个汉字三个字节
func getStringByteLength(string:String) ->Int{
var bytes: [UInt8] = []
for char in string.utf8{
//print("char:\(char)")
bytes.append(char.advanced(by:0))
}
print("\(string)长度:\(bytes.count)")
return bytes.count
}
//一个汉字三个字节