all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Arash Esbati <arash@gnu.org>
To: carlmarcos--- via Users list for the GNU Emacs text editor
	<help-gnu-emacs@gnu.org>
Cc: tomas@tuxteam.de,  carlmarcos@tutanota.com
Subject: Re: Tools for those working heavily with strings
Date: Sun, 24 Jul 2022 15:11:06 +0200	[thread overview]
Message-ID: <8635eqhd05.fsf@gnu.org> (raw)
In-Reply-To: <N7k-xRK--3-2@tutanota.com> (carlmarcos's message of "Sun, 24 Jul 2022 13:42:14 +0200 (CEST)")

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



  reply	other threads:[~2022-07-24 13:11 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-24  5:04 Tools for those working heavily with strings carlmarcos--- via Users list for the GNU Emacs text editor
2022-07-24  5:11 ` Jean Louis
2022-07-24  5:17   ` carlmarcos--- via Users list for the GNU Emacs text editor
2022-07-24  8:45     ` Jean Louis
2022-07-24  8:44   ` Jean Louis
2022-07-24 11:12     ` carlmarcos--- via Users list for the GNU Emacs text editor
2022-07-24 11:26       ` tomas
2022-07-24 11:42         ` carlmarcos--- via Users list for the GNU Emacs text editor
2022-07-24 13:11           ` Arash Esbati [this message]
2022-07-24 13:17           ` tomas
2022-07-24 13:20             ` Philip Kaludercic
2022-07-24 13:23               ` tomas
2022-07-24 14:45                 ` Philip Kaludercic
2022-07-24 20:04           ` Jean Louis
2022-07-24 20:00       ` Jean Louis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8635eqhd05.fsf@gnu.org \
    --to=arash@gnu.org \
    --cc=carlmarcos@tutanota.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=tomas@tuxteam.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.