|
From: | Arash Esbati |
Subject: | Re: Tools for those working heavily with strings |
Date: | Sun, 24 Jul 2022 15:11:06 +0200 |
User-agent: | Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 |
carlmarcos--- via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> writes: > What can I use to test whether a string in composed of whitespace or > is empty? I'm not sure if I understand the "composed of whitespace" part correctly, but you can try: (let ((s "With space")) (and (string-match " " s) (message "With space"))) (let ((s " ")) (and (string-match "\\`[[:space:]]*\\'" s) (message "Only spaces"))) (let ((s "")) (and (string= s "") (message "Empty string"))) (let ((s "")) (and (= (length s) 0) (message "Empty string"))) Best, Arash
[Prev in Thread] | Current Thread | [Next in Thread] |