10 is the sum of 1 2 3 4 On Wednesday, December 2, 2020 at 4:20:52 PM UTC-6 coda coder wrote:
> Mark... I see it. You left some debugging in there: <<place>> > > On Wednesday, December 2, 2020 at 4:17:21 PM UTC-6 [email protected] > wrote: > >> If it helps there is a pad[] operator in the pre-release. >> >> On Wednesday, December 2, 2020 at 10:41:11 PM UTC+1 Mark S. wrote: >> >>> Here's my first attempt. It uses the 5.1.23 search-replace filter >>> operator. It requires the input to be padded to 4 bytes. >>> >>> Now that I've done it, I realize it could probably be written with a >>> recursive loop and be open ended (not needing to be padded). >>> >>> \define hex2dec2(hex) >>> <$vars myhex=<<__hex__>> >>> myfilter="[split[]nth<place>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="1 2 3 4" variable="place"><<place>> >>> <$list filter="[<myhex>subfilter<myfilter>] >>> [<place>compare:number:eq[1]then[4096]else[1]] [<myhex>subfilter<myfilter>] >>> [<place>compare:number:eq[2]then[256]else[1]] [<myhex>subfilter<myfilter>] >>> [<place>compare:number:eq[3]then[16]else[1]]+[product[]]"/> >>> </$list> >>> </$vars> >>> \end >>> \define hex2dec(hex) >>> <$wikify text="<<hex2dec2 $hex$>>" name=dec> >>> <$list filter="[enlist<dec>sum[]]"/> >>> </$wikify> >>> \end >>> <<hex2dec EA0E>> >>> >>> On Wednesday, December 2, 2020 at 3:34:02 AM UTC-8 TW Tones wrote: >>> >>>> Mark, >>>> >>>> On this occasion I need to convert a 4 digit Hex to a decimal, so that >>>> I can use it in the range widget, because we cant generate a range of hex >>>> numbers. >>>> >>>>> >>>>>> -- 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/c1848e59-5358-4cc2-bfdd-bd9eb4417346n%40googlegroups.com.

