Function voca_rs::chop::removesuffix

source ·
pub fn removesuffix(subject: &str, prefix: &str) -> String
Expand description

Extracts the suffix from subject.

Arguments

  • subject - The string to extract from.
  • suffix - The string to extract if ends with it.

Example

use voca_rs::*;
chop::removesuffix("Once upon a time", "time");
// => "Once upon a "
chop::removesuffix("O̱̣̊ñç̉é ụ̈̇pǒ̵̱n ą̆ tímę", "tímę");
// => "O̱̣̊ñç̉é ụ̈̇pǒ̵̱n ą̆ "
use voca_rs::Voca;
"Once upon a time"._removesuffix("time");
// => "Once upon a "