Sample code for 30+ languages & platforms
Rust

StringBuilder RemoveBefore

Demonstrates the StringBuilder.RemoveBefore method.

The GetBefore method was added in Chilkat v9.5.0.77

Chilkat Rust Downloads

Rust

let sb = chilkat::StringBuilder::new();
let _ = sb.append("http://www.chilkatsoft.com").is_ok();

// The RemoveBefore method removes the chars up to and including 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_before(&marker).is_ok();

println!("bFound = {}", b_found);
println!("sb contains: {}", sb.get_as_string().unwrap_or_default());

// Output is:
// bFound = true
// sb contains: www.chilkatsoft.com