pub fn chomp(text: &mut String)
Expand description
Removes the trailing newline of the given string.
It modifies the string in place.
It was inspired by Perl’s chomp()
.
§Examples
let mut hello = String::from("hello\n");
let mut world = String::from("world\r\n");
jabba_lib::jstring::chomp(&mut hello);
jabba_lib::jstring::chomp(&mut world);
assert_eq!(hello, "hello");
assert_eq!(world, "world");