Skip to main content

normalize_string

Function normalize_string 

Source
pub fn normalize_string(s: &str, to_lowercase: bool) -> Cow<'_, str>
Expand description

Trim whitespace and normalize case efficiently

This function combines trimming and case normalization in a single pass when possible.

§Arguments

  • s - The string to normalize
  • to_lowercase - Whether to convert to lowercase

§Returns

A normalized string, borrowing when no changes are needed