我正在寻找一个示例,说明如何从变量末尾删除一个或多个空格。
(let ((test-variable "hello "))
(if (eq ?\s (aref test-variable (1- (length test-variable))))
(setq test-variable "hello")))
最佳答案
简单:(car (split-string "hello "))
==>“你好”
您还可以按照文档字符串的建议显式使用参数TRIM
:
(split-string "hello "
split-string-default-separators
t
split-string-default-separators)