Function: kotl-label:alpha-to-int

kotl-label:alpha-to-int is a byte-compiled function defined in klabel.el.

Signature

(kotl-label:alpha-to-int ALPHA-LABEL)

Documentation

Return integer value of ALPHA-LABEL, e.g. b return 2.

Assume ALPHA-LABEL is alphabetic and lowercase.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/kotl/klabel.el
;;;
;;; kotl-label--the rightmost (deepest level) part of a full label,
;;;             e.g. the full label "1a2" has kotl-label "2".
;;;
(defun kotl-label:alpha-to-int (alpha-label)
  "Return integer value of ALPHA-LABEL, e.g. `b' return 2.
Assume ALPHA-LABEL is alphabetic and lowercase."
  (let ((power (length alpha-label))
	(digit 0)
	(min (1- ?a)))
    (apply '+ (mapcar (lambda (chr)
			(setq digit (- chr min)
			      power (1- power))
			(* digit (expt 26 power)))
	       alpha-label))))