.encodeUTF16()
Description
encodeUTF16 converts a string to its UTF-16 encoded representation.
Parameters
encodeUTF16 takes no parameters.
Usage On Strings
str = "Hello"
log str.encodeUTF16()
// Returns UTF-16 encoded string
str = "🌟"
log str.encodeUTF16()
// Unicode characters are properly encoded
// Can be decoded back with decodeUTF16
encoded = "Hello".encodeUTF16()
decoded = encoded.decodeUTF16()
log decoded
// "Hello"
Last updated
Was this helpful?