How remove specific char from String in Rust?

Hi, how can i remove these specific chars in this String ?
To optain "Bob esponja" ?

Bob esponja [2016] - 090

I can´t remove:
2016 - 090

Are you always trying to remove everything after the first '[', plus any preceding whitespace? If so, here's one way:

    if let Some(idx) = name.split('[').next().map(|s| str::trim_end().len()) {


Or if you want a new string instead of modifying the one you have, that'd be

    let new_name = name

Thank you so much.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.