Wonya
1
Im trying to read string from file.
like a:Strings = “124,247,42,32”
i want to split this with “,” delimiter. and
convert to u8 Vec = vec[127,247,42,32]
i tried split(“,”).map(|x| x.as_bytes()).collect()
but this gives iterator related error.
how can i achieve this?
That's str::as_bytes
, which gives you the UTF-8 bytes of the string, not what you want. You're probably looking for str::parse
.
4 Likes
system
Closed
3
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.