Logo

Programming-Idioms

History of Idiom 151 > diff from v16 to v17

Edit summary for version 17 by Plecra:
New Rust implementation by user [Plecra]

Version 16

2020-05-29, 15:13:55

Version 17

2020-07-15, 16:39:33

Idiom #151 Remove string trailing path separator

Remove last character from string p, if this character is the file path separator of current platform.

Note that this also transforms unix root path "/" into empty string!

Idiom #151 Remove string trailing path separator

Remove last character from string p, if this character is the file path separator of current platform.

Note that this also transforms unix root path "/" into empty string!

Variables
p
Variables
p
Extra Keywords
trim
Extra Keywords
trim
Code
let p = "her/sim/".strip_suffix(std::path::is_separator);
Doc URL
https://doc.rust-lang.org/std/primitive.str.html#method.strip_suffix