Testing, Nice work, It takes a bit to follow the code, but I am sure I will learn something, thanks so much.
You may see it in a Unicode database soon. Tones On Thursday, 3 December 2020 at 16:53:47 UTC+11 Mark S. wrote: > Here's a recursive version that that can be any length of hex. Lightly > tested. Hopefully it's working OK. > > \define hex2dec2(byte,mult:1) > <$vars > myfilter="[search-replace:g[A],[10]search-replace:g[B],[11]search-replace:g[C],[12]search-replace:g[D],[13]search-replace:g[E],[14]search-replace:g[F],[15]]"> > <$list filter=" > [<__byte__>subfilter<myfilter>] > =[<__mult__>] > +[product[]] > "/> > </$vars> > \end > \define hex2dec-r(hex,mult) > <$list filter="[<__mult__>] =16 +[product[]]" variable="mult"> > <$list filter="[<__hex__>split[]nth[1]]" variable="byte"> > <$list filter="[<__hex__>split[]rest[]join[]]" variable="hex" > emptyMessage="<$macrocall $name=hex2dec2 byte=<<__hex__>> > mult=<<__mult__>> />" > > > <$macrocall $name=hex2dec2 byte=<<byte>> mult=<<__mult__>> /> > <$macrocall $name="hex2dec-r" hex=<<hex>> mult=<<mult>> /> > </$list></$list></$list> > \end > \define hex2dec-setup(hex) > <$list filter="[<__hex__>split[]reverse[]join[]]" variable=rhex> > <$macrocall $name=hex2dec-r hex=<<rhex>> mult=1 /> > </$list> > \end > \define hex2dec(hex) > <$wikify text="<<hex2dec-setup $hex$>>" name=dec> > <$list filter="[enlist<dec>sum[]]"/> > </$wikify> > \end > > <<hex2dec F111>> > > > > On Wednesday, December 2, 2020 at 5:42:55 PM UTC-8 TW Tones wrote: > >> Mark, >> >> Good start. I was thinking how to get 16^0 16^1 16^2 and 16^3 and you >> have hard coded it. If moving to a recursive process we may be able to >> handle variable length hex. >> >>> >>>>>> -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/5c7a0bb5-5b9c-4c26-b4fd-a6f70da93508n%40googlegroups.com.

