Skip to main content

parse_emoji_sequences

Function parse_emoji_sequences 

Source
pub fn parse_emoji_sequences(contents: &str) -> HashMap<String, String>
Expand description

Parses emoji sequences and their descriptive labels from a string.

Each line in the input typically consists of three fields separated by semicolons, for example:

26A1 ; emoji ; L1 ; none ; a j # V4.0 (⚡) HIGH VOLTAGE SIGN

The mapping constructed will use the UTF-8 emoji sequence as the key and a normalized, human-readable label as the value. For instance:

  • "⚡""high-voltage-sign"

Lines starting with # or empty lines are ignored. Comments after a # are parsed to extract descriptive labels.

§Examples

use html_generator::emojis::parse_emoji_sequences;

let raw = "26A1 ; emoji ; L1 ; none ; a j # V4.0 (⚡) HIGH VOLTAGE SIGN\n";
let map = parse_emoji_sequences(raw);
assert_eq!(map.get("⚡"), Some(&"high-voltage-sign".to_string()));