From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Pierre Rouleau Newsgroups: gmane.emacs.help Subject: Re: Getting substring Date: Wed, 16 Aug 2023 23:01:52 -0400 Message-ID: References: <9fm604dCSvQkhO587DywcXOS5jONHikAYJ4WtrWnM8ZR89XF9PXE6TEG0R852J8kUWBUoxIWk6oZZcbgG7kgVG5jcX_UlCMSlESsIeywEhw=@protonmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15405"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Heime via Users list for the GNU Emacs text editor To: Heime Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Aug 17 05:02:37 2023 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 1qWTHR-0003qc-CD for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 17 Aug 2023 05:02:37 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qWTHA-0001Uz-2e; Wed, 16 Aug 2023 23:02:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qWTGx-0001NQ-8T for help-gnu-emacs@gnu.org; Wed, 16 Aug 2023 23:02:10 -0400 Original-Received: from mail-vk1-xa34.google.com ([2607:f8b0:4864:20::a34]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qWTGv-0001ED-1O for help-gnu-emacs@gnu.org; Wed, 16 Aug 2023 23:02:07 -0400 Original-Received: by mail-vk1-xa34.google.com with SMTP id 71dfb90a1353d-488f2941019so654130e0c.0 for ; Wed, 16 Aug 2023 20:02:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692241323; x=1692846123; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=1c+xV1hWWB5Lssv/y/nR+hCwjf0cJGfxSuUS3DxjIXQ=; b=JgKz9441kNFlGtDe3or5ezKEXDZLcfZ0MvlqkP0QCF4db7t0i7c59k8sEBq3OAH4O2 cTAHs0bb+1XWzas7KMkNAJH//wOTc2dI3LT5jY3TNyF9UafouIyHA4qeOLJTeNQN6DaV +qwe2SC/xGIoqxsP2n+6HYFY7CGUaTzzcuxE45X4ZKF48bHEtavwaGYcBruO08umJGPY s31A9zS1ETjeK6VapLTkL6dN58o/0FYPyC8avoVjLG6TEKma9p3M9aTg4mwpEZAU3n3/ zR/+PPJbgwV1tWEcxYo5QuFXYeR3UjjOcLk19DDGNH7UNcdYspSyrsKo8ftSDlDeFkdk W8GA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692241323; x=1692846123; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=1c+xV1hWWB5Lssv/y/nR+hCwjf0cJGfxSuUS3DxjIXQ=; b=J4fvd8BR87BdrjOugfP/5GBTd/UUF6zvP9Yr/qK7CpLUX3d1Xgu+al5cj4tXe4KdKW uQsoGxsLqY5DPzbfcFkgWSvUq/hnQf1j9gYy06llFtJtxuTad9cqHXrWljoil3rskIuJ EDziYhgqsmzsnr3YM41JGkEh+30Z/eT4heeuf7reGePM3X4Js+ZSHHbHiBDDjlcst8v3 Paq7Gf8lNKMvhjfxTVIySIa+8bD6KtzLQLacC410mPy74e181szJfQ1gs2erEAwR2/dy FaabdnwtNbOinL4UOXN0a1RJbdnbnXfQ3xW0SvoVWbWe5Ww//Yq9oLb8vRI5QvUpC+zs z9KQ== X-Gm-Message-State: AOJu0YwaZSW1iNcvmwz/IRe9UlBQh/pr8sMo9hLKDEVUo0oJgO/umqcR NLGGgOMJoOfuVOwq/F+beHfBG69BzKkLk3BkElQ= X-Google-Smtp-Source: AGHT+IHwvr9TjFrFe3te8qbB2dydEwsWi4mz0GzSoyv+W9oLWjiHkrS6lMOPQRUEdKEhKXT6SWR3r5jPcuwLIx8HTUU= X-Received: by 2002:a1f:5e0a:0:b0:487:ca7b:d8ea with SMTP id s10-20020a1f5e0a000000b00487ca7bd8eamr2561543vkb.1.1692241323102; Wed, 16 Aug 2023 20:02:03 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::a34; envelope-from=prouleau001@gmail.com; helo=mail-vk1-xa34.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:144847 Archived-At: > > Why does the following not print the first word? > > > > > > > (message "%s TEST: " (car (split-string grafm))) > > > > > > Are you sure it does not print it? It prints bigoplus for me. > > > You can also look into the 'Message' buffer to see what was printed b= y > > > the message function. - Pierre > > I now realise my mistake of putting "%s" before "TEST". I was thus doing > things > correctly after all. > > The command (car (split-string grafm)) also works if there are no spaces = in > 'grafm', it still returns the string as a first element in the list resul= t. > > Not sure I follow you... - You do understand that message is just a string formatting function that takes arguments to put in places identified by the '%s', right? - And that format does something similar but just returns the formatted string. - therefore you can use ielm to test your code (use it!): Here's a session: ELISP> (setq str "bigoplus =E2=A8=81=EF=B8=81") "bigoplus =E2=A8=81=EF=B8=81" ELISP> (car (split-string str)) "bigoplus" ELISP> (format " 123-- %s -- " (car (split-string str))) " 123-- bigoplus -- " ELISP> (format "%s TEST" (car (split-string str))) "bigoplus TEST" ELISP> (format "Survey says: %s " (car (split-string str))) "Survey says: bigoplus " ELISP> --=20 /Pierre