fn trim_end_but_line_feed(trim_end: bool, result: String) -> String
Trims whitespaces to the right except for the line feed character.