Function std::str::from_utf16
pub fn from_utf16(v: &[u16]) -> Option<~str>
Decode a UTF-16 encoded vector v
into a string, returning None
if v
contains any invalid data.
Example
use std::str; // š¯„˛music let mut v = [0xD834, 0xDD1E, 0x006d, 0x0075, 0x0073, 0x0069, 0x0063]; assert_eq!(str::from_utf16(v), Some(~"š¯„˛music")); // š¯„˛mu<invalid>ic v[4] = 0xD800; assert_eq!(str::from_utf16(v), None);