unofficial mirror of emacs-devel@gnu.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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).