let b:Character = "c"
extension Character {
/* extension accessible as function */
func asByteArray() -> [UInt8] {
return String(self).utf8.map{UInt8($0)}
}
/* or, as @LeoDabus pointed out below (thanks!),
use a computed property for this simple case */
var byteArray : [UInt8] {
return String(self).utf8.map{UInt8($0)}
}
}