var str = "J\x{332}o\x{332}s\x{332}e\x{301}\x{332}"
UTF-8 byte length (default):
say str.bytes.len #=> 14
UTF-16 byte length:
say str.encode('UTF-16').bytes.len #=> 20
say str.chars.len #=> 9
say str.graphs.len #=> 4
Last updated 1 year ago