emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

`string-words'


From: Emanuel Berg
Subject: `string-words'
Date: Sun, 14 Jul 2024 20:09:04 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]