Function libmacchina::extra::pop_newline [−][src]
Expand description
This function pops \n
from the end of a given String
if it is found.
This can come in handy when reading the contents of a file that might contain a newline control character at the end of the line.
Files of this kind are very common on GNU/Linux systems.
Example
use libmacchina::extra::pop_newline;
let a = String::from("Foobar\n");
let b = String::from("Foobar");
assert_eq!(pop_newline(a), b);