Function slash_formatter::delete_end_file_separator_owned
source · Expand description
Delete an ending FILE_SEPARATOR in a string except for the FILE_SEPARATOR.
extern crate slash_formatter;
let s = if cfg!(windows) {
String::from(r"path\")
} else {
String::from("path/")
};
let s = slash_formatter::delete_end_file_separator_owned(s);
assert_eq!("path", s);