Efficient trimming of a String
问题 I have a file in the csv format with a first column of data that represents item code optionally ended with "UNIUNI" or mixed case of these chars, loaded by means of a barcode reader. I need to trim away the last "UNI" s. In Rust I tried to write with partial success a function essentially like this: fn main() { // Ok: from "9846UNIUNI" to "9846" println!("{}", read_csv_rilev("9846UNIUNI".to_string())); // Wrong: from "9846uniuni" to "9846" println!("{}", read_csv_rilev("9846uniuni".to_string