#byte #string-representation #ascii #numbers #string-parser #vec-u8 #return

str_to_bytes

parse a string representations of numbers or ascii text and return a Vec<u8>

6 releases

0.2.3 Nov 14, 2022
0.2.2 Nov 14, 2022
0.2.0 Oct 21, 2022
0.1.1 Nov 7, 2022
0.1.0 Oct 21, 2022

#14 in #vec-u8


Used in bluerepl

MIT license

15KB
244 lines

str_to_bytes

A library to parse a string representations of numbers or ascii text and return a Vec<u8>.

This library was originally created to be used in bluerepl

Examples

"0xff 0xfa 0b11" => [0xff, 0xfa, 0b11]
"0b01 ASCII(abc) 12 44 0x35" => [0b01, 97, 98, 99, 12, 44, 0x35]
...

Formats

  • 0b... or 0B... -> Binary number
  • 0x... or 0X... -> Hexadecimal number
  • 123 -> decimal number
  • ASCII(...) -> Ascii text

License

This library is licensed under the terms of the MIT license.

Dependencies

~2.2–3MB
~55K SLoC