pub fn replace_substring(
string: &str,
begin: i32,
end: i32,
replacement: char,
) -> StringExpand description
Replaces a range of characters in string with the given replacement. The range is begin to end.
- begin –> inclusive
- end –> exclusive
The string with the replaced substring gets returned.
§Example:
let input: &str = "Hello, World!";
let result: String = funny_string::replace_substring(input, 1, 5, 'X');
// result now contains the string "HXXXX, World!"