How to easily translate hex string into usize or bytes

for example, I'm gotting "0x2A2F" and how to translate it into the actual number?

I want a high performance way without other crates. Or if there is a good crate implemented for it, I'm going to learn about it.

The various from_str_radix functions may help. For example:

let result = usize::from_str_radix("2A2F", 16);
assert_eq!(result, Ok(10799));
3 Likes

Thanku, that's what i need

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.