将字符串转换为 UTF-8 字节
Convert String to UTF-8 bytes
如何将 Ceylon 中的字符串编码为 UTF-8 字节?
value string = "my_string";
[Byte*] bytes = string.______;
import ceylon.buffer.charset {
utf8
}
shared void run() {
value string = "my_string";
List<Byte> bytes = utf8.encode(string);
Byte[] bytesSequence = bytes.sequence(); // in case a List isn’t enough
}
如何将 Ceylon 中的字符串编码为 UTF-8 字节?
value string = "my_string";
[Byte*] bytes = string.______;
import ceylon.buffer.charset {
utf8
}
shared void run() {
value string = "my_string";
List<Byte> bytes = utf8.encode(string);
Byte[] bytesSequence = bytes.sequence(); // in case a List isn’t enough
}