您可以遍历UTF8代码点并创建数组:
var str = "hello,world" var byteArray = [Byte]() for char in str.utf8{ byteArray += [char] } println(byteArray)