Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: CHR$(foo) => ${(#)foo}
- X-seq: zsh-workers 21968
 
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
 
- To: zsh-workers@xxxxxxxxxx (Zsh hackers list)
 
- Subject: Re: PATCH: CHR$(foo) => ${(#)foo}
 
- Date: Tue, 01 Nov 2005 17:20:51 +0000
 
- In-reply-to: <200511011434.jA1EYf5B020570@xxxxxxxxxxxxxx>
 
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
 
- References: <200511011434.jA1EYf5B020570@xxxxxxxxxxxxxx>
 
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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author