如何截取 m4 中字符串的最后一个字符
我正在尝试创建一个宏来删除 m4 中字符串的最后一个字符,我尝试执行以下操作:
define(`delete_last',substr(`$1',`0',eval(``len($1)'-1')))dnl
这是最接近工作的宏,但我仍然无法正确实现它。我现在需要一些帮助。
I am trying to create a macro for deleting the last char of a string in m4, I have trying to do something like:
define(`delete_last',substr(`$1',`0',eval(``len($1)'-1')))dnl
This is the one that has been closest to work, but still I cannot achieve it properly. I need some help now.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不知道这是最好的方法,但它有效:
Don't know it this is the optimal way to do it, but it works:
我最近不得不写这样一个宏,对我有用的是:
YMMV。
I recently had to write such a macro, what worked for me was:
YMMV.