Rust U8 To String

[Solved] Rust U8 To String | Rust - Code Explorer | yomemimo.com
Question : rust u8 to string

Answered by : -1vajs8k9qntw

use std::str;
// some bytes, in a vector
let sparkle_heart = vec![240, 159, 146, 150];
// We know these bytes are valid, so just use `unwrap()`.
let sparkle_heart = str::from_utf8(&sparkle_heart).unwrap();

Source : https://doc.rust-lang.org/std/str/fn.from_utf8.html | Last Update : Thu, 16 Dec 21

Answers related to rust u8 to string

Code Explorer Popular Question For Rust