reddit / emacs

How can I coerce numbers in E notation to strings?

vfclists · 2022-08-20 05:16
#+NAME: TableName | Task Id | File Name | |----------+-----------| | 9a9022f5 | one | | 9643747b | two | | 45e6f546 | three | | 45e20549 | four | | 3bfcf5bd | five | | 70f9561e | six | #+BEGIN_SRC elisp :var tbl=TableName :results output raw (let ((somevar '())) (dolist (row tbl) (add-to-list 'somevar (append (list (nth 1 row)) (nth 0 row)))) (print (alist-get "four" somevar nil nil 's-equals-p))) #+END_SRC #+RESULTS: 1.0e+INF After further tests with a variety of numbers it is clear that emacs see a sequence of numbers with an `e` in the middle as a number in E notation format. How can I coerce the values in the columns to be seen as strings?
[deleted] · 2022-08-20 06:00
[deleted]
organic-bookworm · 2022-08-20 08:32
I found out org babel processes table cells with [`org-babel-read`](https://github.com/emacs-straight/org-mode/blob/00adad9357b9123a7b11ecf12c148a5196debcb7/lisp/ob-core.el#L3111). You could wrap strings in double quotes in `TableName` (`"45e20549"`) to avoid casting to numbers in the first place.