pub trait ReplaceWord
where Self: PatternReplace,
{ // Required methods fn replace_word_bounds( &self, word: &str, replacement: &str, bounds: WordBounds, case_insensitive: bool ) -> Self where Self: Sized; fn replace_word( &self, word: &str, replacement: &str, case_insensitive: bool ) -> Self where Self: Sized; fn replace_words( &self, pairs: &[(&str, &str)], case_insensitive: bool ) -> Self where Self: Sized; fn replace_word_sets(&self, pairs: &[(&str, &str, bool)]) -> Self where Self: Sized; // Provided methods fn replace_word_ci(&self, word: &str, replacement: &str) -> Self where Self: Sized { ... } fn replace_word_cs(&self, word: &str, replacement: &str) -> Self where Self: Sized { ... } fn replace_words_ci(&self, pairs: &[(&str, &str)]) -> Self where Self: Sized { ... } fn replace_words_cs(&self, pairs: &[(&str, &str)]) -> Self where Self: Sized { ... } }
Expand description

Methods for whole or partial word replacements

Required Methods§

source

fn replace_word_bounds( &self, word: &str, replacement: &str, bounds: WordBounds, case_insensitive: bool ) -> Self
where Self: Sized,

Replace words with boundary and case_insensitive options

source

fn replace_word( &self, word: &str, replacement: &str, case_insensitive: bool ) -> Self
where Self: Sized,

Replace whole words with case_insensitive options

source

fn replace_words(&self, pairs: &[(&str, &str)], case_insensitive: bool) -> Self
where Self: Sized,

Replace one or pairs of whole words with a boolean case_insensitive flag

source

fn replace_word_sets(&self, pairs: &[(&str, &str, bool)]) -> Self
where Self: Sized,

Replace one or sets of whole words with case_insensitive flags as the last tuple element

Provided Methods§

source

fn replace_word_ci(&self, word: &str, replacement: &str) -> Self
where Self: Sized,

Replace whole words with in case-insensitive mode

source

fn replace_word_cs(&self, word: &str, replacement: &str) -> Self
where Self: Sized,

Replace whole words with in case-sensitive mode

source

fn replace_words_ci(&self, pairs: &[(&str, &str)]) -> Self
where Self: Sized,

Replace one or pairs of whole words in case-insensitive mode

source

fn replace_words_cs(&self, pairs: &[(&str, &str)]) -> Self
where Self: Sized,

Replace one or pairs of whole words in case-sensitive mode

Implementations on Foreign Types§

source§

impl ReplaceWord for String

Methods for whole or partial word replacements

source§

fn replace_word_bounds( &self, word: &str, replacement: &str, bounds: WordBounds, case_insensitive: bool ) -> String

Replace words with boundary and case_insensitive options

source§

fn replace_word( &self, word: &str, replacement: &str, case_insensitive: bool ) -> String

Replace whole words with case_insensitive options

source§

fn replace_words( &self, pairs: &[(&str, &str)], case_insensitive: bool ) -> String

Replace one or pairs of whole words with a boolean case_insensitive flag

source§

fn replace_word_sets(&self, tuples: &[(&str, &str, bool)]) -> String

Replace one or sets of whole words with case_insensitive flags as the last tuple element

Implementors§