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

Re: convert number



On Wed, May 19, 2010 at 11:39 AM, Christian Walther <cptsalek@xxxxxxxxx> wrote:
>
> if there is no mathematical formula for the "conversion table"
> available, I would put this table in a hash, e.g. something like:
>
> typeset -A convtable
> convtable[151]=2
> convtable[152]=2
>
> etc...

You can shortcut this:

typeset -A convtable
convtable=(151 2 152 2 153 2 158 4 159 3 160 2 171 4 172 1 173 4)

Note that you must have an even number of elements in the assignment
list, because they are taken as key value key value etc.  The
assignment will fail otherwise.



Messages sorted by: Reverse Date, Date, Thread, Author