Skip to navigation
Remove last characters from a rust string
21.07.23
Using truncate() The truncate() method of the String type can also be used to remove the last character from a string. Here's an example: ```rust let mut my_string = String::from("Hello, world!"); my_string.truncate(my_string.len() - 1); println!("{}", my_string); // prints "Hello, world" ```
https://www.hackertouch.com/rust-remove-last-character-from-string.html
Reply
Anonymous
Information Epoch 1751564528
Think parallel.
Home
Notebook
Contact us