The words Under construction in black text on a yellow background with diagonal black stipes surrounding it
I'm in the process of moving my site. It's still a work in progress. Please excuse the mess and broken links.

Remove Characters From The End Of A String In Rust

TODO: Pull subtitle into page object
Code
fn main() {
    let source = "alfabravocharlie";
    let chopped = source.get(0..4).unwrap();
    println!("{}", chopped);
}
Results
alfa

Notes

Debugging Stuff

I'm moving stuff around right now. All this below is helping me figure out where to put stuff

        -- title

Remove Characters From The End Of A String In Rust

-- code
-- rust

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

-- results

alfa


-- notes

- 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



-- categories
-- Rust 

-- metadata
-- date: 2023-05-14 17:55:37
-- id: 2pnmhi1o
-- site: aws
-- type: post
-- status: draft