Get a &str from a fixed length byte array with no_std

Is it possible to get a &str from a fixed length byte arrray?

I tried, but could not work out how to do it.

It feels like it should be possible, as the bytes are there in memory and size is fixed.

You need std::str::from_utf8(). Btw, you can define byte arrays with the syntax b"abc".

but that is in std, i need no_std

Also in core :slight_smile:

4 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.