flatten_variable

Function flatten_variable 

Source
pub fn flatten_variable(variable: impl AsRef<str>) -> String
Expand description

Normalizes a variable name string that may contain multiple segments separated by |.

Each segment is individually processed by flatten_str.

After processing, any segments that become empty are removed. The remaining non-empty, flattened segments are then joined back together with |.

§Examples

let variable = "  First Segment | SÉCOND Part |  | Last One! || ";
let flattened = flatten_variable(variable);
assert_eq!(flattened, "first segment|second part|last one");