Trait string_patterns::words::ReplaceWord
source · pub trait ReplaceWordwhere
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§
sourcefn replace_word_bounds(
&self,
word: &str,
replacement: &str,
bounds: WordBounds,
case_insensitive: bool
) -> Selfwhere
Self: Sized,
fn replace_word_bounds(
&self,
word: &str,
replacement: &str,
bounds: WordBounds,
case_insensitive: bool
) -> Selfwhere
Self: Sized,
Replace words with boundary and case_insensitive options
sourcefn replace_word(
&self,
word: &str,
replacement: &str,
case_insensitive: bool
) -> Selfwhere
Self: Sized,
fn replace_word(
&self,
word: &str,
replacement: &str,
case_insensitive: bool
) -> Selfwhere
Self: Sized,
Replace whole words with case_insensitive options
Provided Methods§
sourcefn replace_word_ci(&self, word: &str, replacement: &str) -> Selfwhere
Self: Sized,
fn replace_word_ci(&self, word: &str, replacement: &str) -> Selfwhere
Self: Sized,
Replace whole words with in case-insensitive mode
sourcefn replace_word_cs(&self, word: &str, replacement: &str) -> Selfwhere
Self: Sized,
fn replace_word_cs(&self, word: &str, replacement: &str) -> Selfwhere
Self: Sized,
Replace whole words with in case-sensitive mode
sourcefn replace_words_ci(&self, pairs: &[(&str, &str)]) -> Selfwhere
Self: Sized,
fn replace_words_ci(&self, pairs: &[(&str, &str)]) -> Selfwhere
Self: Sized,
Replace one or pairs of whole words in case-insensitive mode
sourcefn replace_words_cs(&self, pairs: &[(&str, &str)]) -> Selfwhere
Self: Sized,
fn replace_words_cs(&self, pairs: &[(&str, &str)]) -> Selfwhere
Self: Sized,
Replace one or pairs of whole words in case-sensitive mode
Implementations on Foreign Types§
source§impl ReplaceWord for String
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
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
fn replace_word( &self, word: &str, replacement: &str, case_insensitive: bool ) -> String
Replace whole words with case_insensitive options