Function: org-table-clean-line

org-table-clean-line is a byte-compiled function defined in org-table.el.gz.

Signature

(org-table-clean-line S)

Documentation

Convert a table line S into a string with only "|" and space.

In particular, this does handle wide and invisible characters.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-table.el.gz
(defun org-table-clean-line (s)
  "Convert a table line S into a string with only \"|\" and space.
In particular, this does handle wide and invisible characters."
  (if (string-match "^[ \t]*|-" s)
      ;; It's a hline, just map the characters
      (setq s (mapconcat (lambda (x) (if (member x '(?| ?+)) "|" " ")) s ""))
    (while (string-match "|\\([ \t]*?[^ \t\r\n|][^\r\n|]*\\)|" s)
      (setq s (replace-match
	       (concat "|"
                       (make-string
                        (save-match-data
                          (org-string-width (match-string 1 s) nil 'org-table))
			?\ )
                       "|")
	       t t s)))
    s))