string_to_hex

Function string_to_hex 

Source
pub fn string_to_hex(s: &str) -> String
Expand description

Converts a string to its hexadecimal representation.

This function takes a string slice and returns a hexadecimal string representing the UTF-8 bytes of the input string.

§Arguments

  • s - A string slice to convert to hexadecimal.

§Returns

A String containing the hexadecimal representation of the input string’s UTF-8 bytes.

§Example

let string = "Hello";
let hex = byteutils::string_to_hex(string);
assert_eq!(hex, "48656c6c6f");