Rust
Rust
StringBuilder RemoveAfterFinal
Demonstrates the StringBuilder.RemoveAfterFinal method.The GetBefore method was added in Chilkat v9.5.0.77
Chilkat Rust Downloads
let sb = chilkat::StringBuilder::new();
let _ = sb.append("abc::def::ghi").is_ok();
// The RemoveAfterFinal method removes the chars after the final occurrence of the marker.
// It also removes the marker string.
// If the marker is not found, then nothing is removed and the method returns false.
let marker = "::".to_string();
let b_found = sb.remove_after_final(&marker).is_ok();
println!("bFound = {}", b_found);
println!("sb contains: {}", sb.get_as_string().unwrap_or_default());
// Output is:
// bFound = true
// sb contains: abc::def