Last nonblank character
Return last nonblank character in a string.
Compiled as Common Lisp using GNU CLISP.
1
2
"foo" ⟹ "o"
"foo " ⟹ "o"
1
2
3
(defun last-nonblank (str)
(subseq (string-right-trim '(#\Space) str)
(- (length (string-right-trim '(#\Space) str)) 1)))