Sample code for 30+ languages & platforms
Rust

Remove a Range of Chars from a StringBuilder

Demonstrates how to remove a range of chars from the string contained in a StringBuilder object.

Note: This example demonstrates the RemoveCharsAt method which was added in Chilkat v9.5.0.87.

Chilkat Rust Downloads

Rust

let sb = chilkat::StringBuilder::new();

// Load a file that contains this string:  0123456789ABCDEF
let _ = sb.load_file("qa_data/txt/remove_chars.txt", "utf-8").is_ok();

// Remove "56789A" from the string.
let _ = sb.remove_chars_at(5, 6);

println!("{}", sb.get_as_string().unwrap_or_default());

// Output is: 01234BCDEF