Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: CHR$(foo) => ${(#)foo}



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