[−][src]Function voca_rs::manipulate::splice
pub fn splice(
subject: &str,
start: isize,
delete_count: usize,
to_add: &str
) -> String
Changes subject
by deleting delete_count
of characters starting at position start
. Places a new string to_add
instead of deleted characters.
Arguments
subject
- The string where to insert.start
- The position to start changing the string. For a negative position will start from the end of the string.delete_count
- The number of characters to delete from string.to_add
- The string to be added instead of deleted characters.
Example
use voca_rs::*; manipulate::splice("new year", 0, 4, ""); // => "year" manipulate::splice("to jest błąd", 0, 7, "mój"); // => "mój błąd" manipulate::splice("Die Schildkröte fliegt.", -7, 0, "und Kröte "); // => "Die Schildkröte und Kröte fliegt." manipulate::splice("Привет", 6, 0, ", Ёлка!"); // => "Привет, Ёлка!" use voca_rs::Voca; "new year"._splice(0, 4, ""); // => "year"