Function: org-split-string

org-split-string is a byte-compiled function defined in org-macs.el.

Signature

(org-split-string STRING &optional SEPARATORS)

Documentation

Splits STRING into substrings at SEPARATORS.

SEPARATORS is a regular expression. When nil, it defaults to
"[ \\f\\t\\n\\r\\v]+".

Unlike split-string, matching SEPARATORS at the beginning and end of string are ignored.

Source Code

;; Defined in ~/.emacs.d/elpa/org-9.8.2/org-macs.el
(defun org-split-string (string &optional separators)
  "Splits STRING into substrings at SEPARATORS.

SEPARATORS is a regular expression.  When nil, it defaults to
\"[ \\f\\t\\n\\r\\v]+\".

Unlike `split-string', matching SEPARATORS at the beginning and
end of string are ignored."
  (let ((separators (or separators "[ \f\t\n\r\v]+")))
    (if (not (string-match separators string)) (list string)
      (let ((i (match-end 0))
	    (results
	     (and (/= 0 (match-beginning 0)) ;skip leading separator
		  (list (substring string 0 (match-beginning 0))))))
	(while (string-match separators string i)
	  (push (substring string i (match-beginning 0))
		results)
	  (setq i (match-end 0)))
	(nreverse (if (= i (length string))
		      results		;skip trailing separator
		    (cons (substring string i) results)))))))