Function: ses-decode-cell-symbol
ses-decode-cell-symbol is a byte-compiled function defined in
ses.el.gz.
Signature
(ses-decode-cell-symbol STR)
Documentation
Decode a symbol "A1" => (0,0).
Return nil if STR is not a canonical cell name.
Source Code
;; Defined in /usr/src/emacs/lisp/ses.el.gz
(defun ses-decode-cell-symbol (str)
"Decode a symbol \"A1\" => (0,0).
Return nil if STR is not a canonical cell name."
(let (case-fold-search)
(and (string-match "\\`\\([A-Z]+\\)\\([0-9]+\\)\\'" str)
(let* ((col-str (match-string-no-properties 1 str))
(col 0)
(col-base 1)
(col-idx (1- (length col-str)))
(row (1- (string-to-number
(match-string-no-properties 2 str)))))
(and (>= row 0)
(progn
(while
(progn
(setq col (+ col (* (- (aref col-str col-idx) ?A)
col-base))
col-base (* col-base 26)
col-idx (1- col-idx))
(and (>= col-idx 0)
(setq col (+ col col-base)))))
(cons row col)))))))