all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* `string-words'
@ 2024-07-14 18:09 Emanuel Berg
  2024-07-14 18:45 ` `string-words' Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Emanuel Berg @ 2024-07-14 18:09 UTC (permalink / raw)
  To: emacs-devel

I've been writing some Elisp, some of it turned up all-Emacs.

Maybe it already exists in Emacs or ELPA, if so I'd be happy
to use that instead. Are there any options?

If not, this is a candidate for a string library.

;;; -*- lexical-binding: t -*-

(defun string-words (str &optional no-sort keep-case)
  (or keep-case (setq str (downcase str)))
  (let ((words (split-string str "[[:space:]()]+" t "[[:punct:]]+")))
    (if no-sort
        words
      (sort words) )))

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-07-15  3:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-14 18:09 `string-words' Emanuel Berg
2024-07-14 18:45 ` `string-words' Eli Zaretskii
2024-07-14 23:35   ` `string-words' Emanuel Berg
2024-07-15  2:29     ` `string-words' Eli Zaretskii
2024-07-15  3:32       ` `string-words' Emanuel Berg

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.