pub trait StripCharacters<'a>where
Self: ToSegments,{
Show 18 methods
// Required methods
fn alphanumeric_chars(&self) -> impl DoubleEndedIterator<Item = char> + '_;
fn strip_non_alphanum(&self) -> String;
fn strip_non_digits(&self) -> String;
fn strip_by_type(&self, ct: CharType<'a>) -> String;
fn strip_by_types(&self, cts: &[CharType<'a>]) -> String;
fn filter_by_type(&self, ct: CharType<'a>) -> String;
fn filter_by_types(&self, cts: &[CharType<'a>]) -> String;
fn to_numeric_strings_strict(
&self,
separator: DecimalSeparator,
) -> Vec<String>;
fn to_numbers_strict<N: FromStr>(
&self,
separator: DecimalSeparator,
) -> Vec<N>;
fn split_to_numbers<N: FromStr + Copy>(&self, pattern: &str) -> Vec<N>;
fn correct_numeric_string_strict(
&self,
separator: DecimalSeparator,
) -> String;
// Provided methods
fn strip_spaces(&self) -> String { ... }
fn to_numeric_strings(&self) -> Vec<String> { ... }
fn to_numbers<N: FromStr>(&self) -> Vec<N> { ... }
fn correct_numeric_string(&self) -> String { ... }
fn to_first_number<N: FromStr + Copy>(&self) -> Option<N> { ... }
fn to_first_number_strict<N: FromStr + Copy>(
&self,
separator: DecimalSeparator,
) -> Option<N> { ... }
fn strip_non_numeric(&self) -> String { ... }
}Expand description
Set of methods to strip unwanted characters by type or extract vectors of numeric strings, integers or floats
Required Methods§
Sourcefn alphanumeric_chars(&self) -> impl DoubleEndedIterator<Item = char> + '_
fn alphanumeric_chars(&self) -> impl DoubleEndedIterator<Item = char> + '_
Lazily iterates the alphanumeric characters only, without allocating a String.
strip_non_alphanum is built on this; prefer this directly if you only need to
scan or compare the filtered characters rather than build an owned copy.
Double-ended, so callers needing to scan from the end can call .rev() on it.
Sourcefn strip_non_alphanum(&self) -> String
fn strip_non_alphanum(&self) -> String
Remove all non-alphanumeric characters
Sourcefn strip_non_digits(&self) -> String
fn strip_non_digits(&self) -> String
Remove all non-digit characters
Sourcefn strip_by_type(&self, ct: CharType<'a>) -> String
fn strip_by_type(&self, ct: CharType<'a>) -> String
Remove characters matching a specific type
Sourcefn strip_by_types(&self, cts: &[CharType<'a>]) -> String
fn strip_by_types(&self, cts: &[CharType<'a>]) -> String
Remove characters matching any of the specified types
Sourcefn filter_by_type(&self, ct: CharType<'a>) -> String
fn filter_by_type(&self, ct: CharType<'a>) -> String
Keep only characters matching a specific type
Sourcefn filter_by_types(&self, cts: &[CharType<'a>]) -> String
fn filter_by_types(&self, cts: &[CharType<'a>]) -> String
Keep only characters matching any of the specified types
Sourcefn to_numeric_strings_strict(&self, separator: DecimalSeparator) -> Vec<String>
fn to_numeric_strings_strict(&self, separator: DecimalSeparator) -> Vec<String>
Extract numeric strings with configurable decimal separator
Sourcefn to_numbers_strict<N: FromStr>(&self, separator: DecimalSeparator) -> Vec<N>
fn to_numbers_strict<N: FromStr>(&self, separator: DecimalSeparator) -> Vec<N>
Parse extracted numbers with configurable decimal separator
Sourcefn split_to_numbers<N: FromStr + Copy>(&self, pattern: &str) -> Vec<N>
fn split_to_numbers<N: FromStr + Copy>(&self, pattern: &str) -> Vec<N>
Split by pattern and extract the first number from each segment
Sourcefn correct_numeric_string_strict(&self, separator: DecimalSeparator) -> String
fn correct_numeric_string_strict(&self, separator: DecimalSeparator) -> String
Normalize numeric string separators based on decimal separator convention
Provided Methods§
Sourcefn strip_spaces(&self) -> String
fn strip_spaces(&self) -> String
Remove whitespace characters
Sourcefn to_numeric_strings(&self) -> Vec<String>
fn to_numeric_strings(&self) -> Vec<String>
Extract numeric strings using auto-detection
Sourcefn to_numbers<N: FromStr>(&self) -> Vec<N>
fn to_numbers<N: FromStr>(&self) -> Vec<N>
Parse numbers using auto-detection
Sourcefn correct_numeric_string(&self) -> String
fn correct_numeric_string(&self) -> String
Normalize numeric string separators using auto-detection
Sourcefn to_first_number<N: FromStr + Copy>(&self) -> Option<N>
fn to_first_number<N: FromStr + Copy>(&self) -> Option<N>
Extract the first parsed number using auto-detection, or None if empty
Sourcefn to_first_number_strict<N: FromStr + Copy>(
&self,
separator: DecimalSeparator,
) -> Option<N>
fn to_first_number_strict<N: FromStr + Copy>( &self, separator: DecimalSeparator, ) -> Option<N>
Extract the first parsed number with configurable decimal separator, or None if empty
Sourcefn strip_non_numeric(&self) -> String
fn strip_non_numeric(&self) -> String
Extract numeric strings and join them with spaces
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".