How to display numbers in different bases under elisp?

六月ゝ 毕业季﹏ 提交于 2019-12-01 17:01:51

As a format string, you are quite limited in the bases you can display:

%d means print as number in decimal (%o octal, %x hex).
%X is like %x, but uses upper case.

You can use the calc library to manage this for you, however:

(require 'calc-bin)

(let ((calc-number-radix 20))
  (math-format-radix 39))
"1J"

(let ((calc-number-radix 20))
  (math-format-radix #20r1j))
"1J"

As with the read syntax you're using, allowed values of calc-number-radix run from 2 to 36.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!