[][src]Function voca_rs::manipulate::replace

pub fn replace(subject: &str, pattern: &str, replacement: &str) -> String

Replaces the matches of pattern with replacement.

Arguments

  • subject - The string to verify.
  • pattern - The pattern which match is replaced. Only the first occurrence replaced.
  • replacement - The string which replaces pattern match.

Example

use voca_rs::*;
manipulate::replace("swan", "wa", "u");
// => "sun"
manipulate::replace("domestic duck", "d", "D");
// => "Domestic duck"
manipulate::replace("Café del Mar cafe\u{0301}", "é", "e");
// => "Cafe del Mar café"
use voca_rs::Voca;
"swan"._replace("wa", "u");
// => "sun"