Overview
Converts a string representation of a hexadecimal number to a Vec<u8>.
Supported are String, Vec<String> and Files.
The string can include spaces and line breaks.
Case insensitive.
Errors
It was not a hexadecimal representation.
Example
String pattern
let text: String = "001234Ab".to_string;
let binary: = convert.unwrap;
// [0x00, 0x12, 0x34, 0xAB]
let text: String = r#"00 12
34 56"#.to_string;
let binary: = convert.unwrap;
// [0x00, 0x12, 0x34, 0x56]
Vec<String> pattern
let lines: = vec!;
let binary: = convert_line.unwrap;
// [0x12, 0x34, 0xAB, 0xCD, 0x00, 0x00]
File pattern
use File;
// target.txt
// 00 12 34
// 56 78 AB
// cd Ef 00
let file: File = open.unwrap;
let binary: = convert_file.unwrap;
// [0x00, 0x12, 0x34, 0x56, 0x78, 0xAB, 0xCD, 0xEF, 0x00]
// target.txt
// cd Ef 00
//
// 56 78 AB
//
// 00 12 34
//
//
let file: File = open.unwrap;
let binary: = convert_file.unwrap;
// [0xCD, 0xEF, 0x00, 0x56, 0x78, 0xAB, 0x00, 0x12, 0x34]
日本語概要
16進数の文字列表現をバイナリデータ(Vec)に変換します。
String、Vec<String>、Fileに対応しています。
文字列には空白、改行コードも含められます。
大文字と小文字を区別しません。
エラー
16進数表現ではなかった。