From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22838 invoked from network); 1 Nov 2005 17:22:16 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 1 Nov 2005 17:22:16 -0000 Received: (qmail 80462 invoked from network); 1 Nov 2005 17:22:11 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 1 Nov 2005 17:22:11 -0000 Received: (qmail 7061 invoked by alias); 1 Nov 2005 17:22:08 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 21968 Received: (qmail 7052 invoked from network); 1 Nov 2005 17:22:07 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 1 Nov 2005 17:22:07 -0000 Received: (qmail 80165 invoked from network); 1 Nov 2005 17:22:07 -0000 Received: from vms044pub.verizon.net (206.46.252.44) by a.mx.sunsite.dk with SMTP; 1 Nov 2005 17:22:05 -0000 Received: from candle.brasslantern.com ([71.116.81.225]) by vms044.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0IPA001JMDIVX3F7@vms044.mailsrvcs.net> for zsh-workers@sunsite.dk; Tue, 01 Nov 2005 11:20:56 -0600 (CST) Received: from candle.brasslantern.com (IDENT:schaefer@localhost [127.0.0.1]) by candle.brasslantern.com (8.12.11/8.12.11) with ESMTP id jA1HKrHK019896 for ; Tue, 01 Nov 2005 09:20:53 -0800 Received: (from schaefer@localhost) by candle.brasslantern.com (8.12.11/8.12.11/Submit) id jA1HKqLY019895 for zsh-workers@sunsite.dk; Tue, 01 Nov 2005 09:20:53 -0800 Date: Tue, 01 Nov 2005 17:20:51 +0000 From: Bart Schaefer Subject: Re: PATCH: CHR$(foo) => ${(#)foo} In-reply-to: <200511011434.jA1EYf5B020570@news01.csr.com> To: zsh-workers@sunsite.dk (Zsh hackers list) Message-id: <1051101172051.ZM19894@candle.brasslantern.com> MIME-version: 1.0 X-Mailer: Z-Mail (5.0.0 30July97) Content-type: text/plain; charset=us-ascii References: <200511011434.jA1EYf5B020570@news01.csr.com> Comments: In reply to Peter Stephenson "PATCH: CHR$(foo) => ${(#)foo}" (Nov 1, 2:34pm) X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.4 On Nov 1, 2:34pm, Peter Stephenson wrote: } } There are lots of ways of turning a number into a character, but few the } other way round Don't you mean "lots of ways of turning a character into a number"? What you added is a way to turn a number into a character. } This adds the (#) expansion flag to do that. So we now have ${#x} Number of characters in x $((#x)) Number of the first character in x ${(#)x} Character of the number in x and the oddball $((##x)) Number of the character 'x' I suppose that means that ${(#)#x} Number of characters in the character of the number in x (i.e., 1) $((##${(#)${#x}})) Number of the character of the number of characters in x There doesn't seem to be a way to get the number of characters in the number of the character of the number in x. Hmm.