bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] mystrtonum for any awk (Was: Handling hexadecimals in dif


From: Jarno Suni
Subject: Re: [bug-gawk] mystrtonum for any awk (Was: Handling hexadecimals in different modes)
Date: Tue, 29 Sep 2015 08:05:09 +0300

On Sun, 27 Sep 2015 13:25:14 +0300
Jarno Suni <address@hidden> wrote:

>      digits="0123456789abcdefghijklmnopqrstuvwxyz"
>      ld=length(digits) # maximum base (36)
>      # Create a lookup table for values of digits:
>      for(i=0; i<length(digits); i++) v[substr(digits,i+1,1)]=i
>      # Upper case digits are equal to lower case:
>      for(i=10; i<length(digits); i++)
> v[toupper(substr(digits,i+1,1))]=i d=substr(sprintf("%g",1.1),2,1); #

BTW. Bash allows even bigger base, but it is case sensitive:
http://wiki.bash-hackers.org/syntax/arith_expr#different_bases

-- 
Jarno Ilari Suni - http://www.iki.fi/8/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]