emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why having string-chop-newline


From: Evgeny Zajcev
Subject: Why having string-chop-newline
Date: Wed, 30 Dec 2020 12:06:39 +0300

Why is `string-chop-newline' needed?

(string-trim-right string "\n") or (string-remove-suffix "\n" string) looks much more descriptive and maintainable.

`string-chop-newline` name does not say us from where newline is chopped

If one need a function to map across a list of strings returning remove newline from the tail, then `partial-apply' could be used, such as:

(mapcar (apply-partially 'string-remove-suffix "\n") list-of-strings-with-trailing-newline)

I propose not to add one-liners just to have them in because other string manipulating packages provides similar one liners

What do you think?

Thanks

--
lg

reply via email to

[Prev in Thread] Current Thread [Next in Thread]