pub fn replace_substring(
original: &str,
start: usize,
end: usize,
replacement: &str,
) -> StringExpand description
Replaces a substring in the original string with a replacement string.
§Arguments
original- The original string.start- The start position of the substring in the original string.end- The end position of the substring in the original string.replacement- The string to replace the substring.
§Returns
- A new string with the replacement in place of the original substring.
§Example
use blogs_md_easy::replace_substring;
let original = "Hello, World!";
let start = 7;
let end = 12;
let replacement = "Rust";
let result = replace_substring(original, start, end, replacement);
println!("{}", result); // Prints: "Hello, Rust!"