Home
Head's Up: I'm in the middle of upgrading my site. Most things are in place, but there are something missing and/or broken including image alt text. Please bear with me while I'm getting things fixed.

Remove Characters From The End Of A String In Rust

rust
fn main() {
    let source = "alfabravocharlie";
    let chopped = source.get(0..4).unwrap();
    println!("{}", chopped);
}
results full

- This is really making a new string with just the selected characters from the beining of the source string, but that's too long for a title

- I genearlly think of this as truncating, but that means completely deleting in some contexts

- This is like a substring in some other langauges. Should probably rename the title to that at some point