From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Arash Esbati Newsgroups: gmane.emacs.help Subject: Re: Tools for those working heavily with strings Date: Sun, 24 Jul 2022 15:11:06 +0200 Message-ID: <8635eqhd05.fsf@gnu.org> References: <3BF84EBF-B87A-49B2-9B0A-AE196B42F2DC@gnu.support> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19667"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 Cc: tomas@tuxteam.de, carlmarcos@tutanota.com To: carlmarcos--- via Users list for the GNU Emacs text editor Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jul 24 15:13:43 2022 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oFbQU-00051r-Ul for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 24 Jul 2022 15:13:43 +0200 Original-Received: from localhost ([::1]:41354 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oFbQT-0003sd-7g for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 24 Jul 2022 09:13:41 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33032) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oFbQ2-0003sV-F8 for help-gnu-emacs@gnu.org; Sun, 24 Jul 2022 09:13:14 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:58836) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oFbQ1-0007ZF-LX; Sun, 24 Jul 2022 09:13:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=6YStcTS7GUFea/quB3UisbdGM9XGlrhqlrIJP6tBqic=; b=QksvDrRmCg99wPjZ0bWt xpXmdCqAuk44R8WXHaZpQtOMb6rx2yWXYMSVj2/IboyodiBPBj28mMq/DFAmDn8RQs9h5Y/oYrdqP OcIs1vB4DVKguB9wYyqAANET19zuYP7/kCj2fOJTDH976u3S742G1cPUFC3dxMw+BYiAw/Hn9gnxA mHcvdeenphZTwHGbOlbGgBb2D3SO7LENlkGLtL5iVewPUey6TX47H1Pw9RxblcfXArU5HzmMpm3FZ YK7L0sjIdCGST3klrrs4klEKi7VrFrqWndBlHruWqX0BYBf864Km8mKRRUwJ8z9R45lTb+UK01hB7 dRTIc9zXGh1U8A==; Original-Received: from pd9fb77f7.dip0.t-ipconnect.de ([217.251.119.247]:65532 helo=MUTANT) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oFbQ0-000749-Si; Sun, 24 Jul 2022 09:13:13 -0400 In-Reply-To: (carlmarcos's message of "Sun, 24 Jul 2022 13:42:14 +0200 (CEST)") X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:138591 Archived-At: carlmarcos--- via Users list for the GNU Emacs text editor 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