From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Sam Steingold Newsgroups: gmane.emacs.help Subject: Re: idiomatic case-insensitive string comparison? Date: Mon, 18 Jul 2022 15:41:28 -0400 Message-ID: References: Reply-To: sds@gnu.org Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19271"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (darwin) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jul 19 06:34:52 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 1oDewe-0004mY-EV for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 19 Jul 2022 06:34:52 +0200 Original-Received: from localhost ([::1]:38686 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDewd-0007A6-FA for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 19 Jul 2022 00:34:51 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45722) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDWcc-00086V-7H for help-gnu-emacs@gnu.org; Mon, 18 Jul 2022 15:41:41 -0400 Original-Received: from mail-qk1-x729.google.com ([2607:f8b0:4864:20::729]:41484) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oDWcW-0007kE-Ef; Mon, 18 Jul 2022 15:41:37 -0400 Original-Received: by mail-qk1-x729.google.com with SMTP id n2so8201607qkk.8; Mon, 18 Jul 2022 12:41:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:subject:in-reply-to:references:user-agent :return-receipt-to:reply-to:mail-followup-to:date:message-id :mime-version; bh=hNidmMhTkOrCfAiL6XUBa4jt3rM8qiaeLrgTyEOXbdQ=; b=XLMKkA5w6EelE9CEGu+HhN8Oo0YSe6yHwdgvvm2mP3/rCECyxvAa9Ogy3IM/Y4iBQe OI33V7v7Vt+PTOsxLycLrDaLciOChbCq85IiZ5ImHObJb3+mbKVk3j8+sJz0LXVdy2kR 83Nx2kWTx45AfrTW/8GusmXJueCA8Gj8gvz88EEDk4RKaXioEoRF+e9JSP1kuR2wjOvF 9KacMHFxSQ0RuIQV/a6UJkqfYpBC8TccdtiAXzRGsr0IdKGkUsEdVuD0n5s6TY0vX/8h H2pqT9k13zuIWMC3T3iwbNOa5u1jhQZ5Gy0AhRBTVmjVt0sV/qsV5VN2mF976KVf6J6s CxDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:subject:in-reply-to:references :user-agent:return-receipt-to:reply-to:mail-followup-to:date :message-id:mime-version; bh=hNidmMhTkOrCfAiL6XUBa4jt3rM8qiaeLrgTyEOXbdQ=; b=m+LFAXS3MXPVvHXeXtU21lbVAyWjWyj02kbLRku+bvqhsfj+ubkp1LaoPzywinx6vO bKXbtOYIrPXJseApJYryX3F2C2tNELeEPDWW8FOlgaDFS99mhjvnovBfPKZ/uuENr7Fn NITitwPzrAai2VJBaLTfUO3WLAeBe23Lqt7fu0m9yr/Aty5ZK+TMxPYaa66Bxa/R7OYL rBtKoe6YFGYAJ1oHNzLDzjYnh+cvJiiOv/t/RSJlHfnfxm5o0ltlCuLQI91OweAHl4ZX 2x1jB6gw7wo5aGZ3DRRzFbdFGr8+USjMfIYVX3qku8dvMc/OQcS2RO9EbHzsN/qWFQhT Ckhg== X-Gm-Message-State: AJIora/uYSe6cN/dJ7MLiX31o/IuSYLz2u93cMeEp2lxUfc75ZYCO9UE ImX6sP1QLn8IlHr6Ew1uDkJaPX2H2w== X-Google-Smtp-Source: AGRyM1s1x8oWNslZU6Okygjtif0iZXB/Zf906YoE4wDQ5fe0g88nvgcW9CGLQCfH7uCHJjIrC3SudA== X-Received: by 2002:a05:620a:198f:b0:6b0:7b7e:a6c6 with SMTP id bm15-20020a05620a198f00b006b07b7ea6c6mr17885526qkb.128.1658173290471; Mon, 18 Jul 2022 12:41:30 -0700 (PDT) Original-Received: from 3c22fb11fdab.ant.amazon.com (pool-108-30-23-113.nycmny.fios.verizon.net. [108.30.23.113]) by smtp.gmail.com with ESMTPSA id dm1-20020a05620a1d4100b006b5c87e9eb1sm11683811qkb.102.2022.07.18.12.41.28 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Jul 2022 12:41:29 -0700 (PDT) In-Reply-To: (Sam Steingold's message of "Mon, 18 Jul 2022 13:47:31 -0400") X-Attribution: Sam X-Disclaimer: You should not expect anyone to agree with me. Mail-Followup-To: help-gnu-emacs@gnu.org Received-SPF: pass client-ip=2607:f8b0:4864:20::729; envelope-from=sam.steingold@gmail.com; helo=mail-qk1-x729.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Tue, 19 Jul 2022 00:33:33 -0400 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:138521 Archived-At: Apparently, I need to do --8<---------------cut here---------------start------------->8--- (defun string=-ic (a b) "case-insensitive string equality test" (eq t (compare-strings a nil nil b nil nil t))) --8<---------------cut here---------------end--------------->8--- I discovered `compare-strings' by noticing that `string-prefix-p' accepts an IGNORE-CASE argument and looking at its source code. -- Sam Steingold (http://sds.podval.org/) on darwin Ns 10.3.2113 http://childpsy.net http://calmchildstories.com http://steingoldpsychology.com https://www.peaceandtolerance.org/ https://camera.org https://ffii.org Between grand theft and a legal fee, there only stands a law degree.