How do I encode a String in Ceylon as UTF-8 bytes?
value string = "my_string"; [Byte*] bytes = string.______;
Use ceylon.buffer.charset.
ceylon.buffer.charset
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 }
Try it!
Use
ceylon.buffer.charset.Try it!