Mohammad,

I am sorry, I am so late to this conversation. But I had requested such 
zero fill, previously on github to prerelease of the Range operator, but 
found a solution that suited me. I planned to make make no claim for it to 
be better or worse than other examples, but perhaps I can :)

<$list filter="[range[.00001,.00100,.00001]removeprefix[0.]]">

</$list>


Do I win?

Regards
Tony



On Saturday, 16 February 2019 03:18:05 UTC+11, Mohammad wrote:
>
> Asked by Josiah here:
>
> https://groups.google.com/d/msg/tiddlywiki/w9Bv-WulKw8/O3RaMUwqBAAJ
>
> To produce numbers zero padded like
>
> 001
> 002
> 003
> ...
>
> 099
> 100
>
> Here is a macro to do that
>
> \define zeropad-range(n:10)
> <$list filter="[range[1,$n$]]" variable=x >
> <$reveal type="lteq" default=<<x>> text="9" >
> <$text text= {{{[<x>addprefix[00]]}}} />
> </$reveal>
> <$reveal type="gt" default=<<x>> text="9" >
> <$text text= {{{[<x>addprefix[0]]}}} />
> </$reveal>
> </$list>
> \end
>
> Example
>
> 001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017018 
> 019 020 021 022 023 024 025
>
> The below macro works up to 1000
>
> \define zeropad-range4(n:10)
> <$list filter="[range[1,$n$]]" variable=x >
> <$reveal type="lteq" default=<<x>> text="9" >
> <$text text= {{{[<x>addprefix[000]]}}} />
> </$reveal>
> <$reveal type="gt" default=<<x>> text="9" >
> <$reveal type="lt" default=<<x>> text="99" >
> <$text text= {{{[<x>addprefix[00]]}}} />
> </$reveal>
> </$reveal>
> <$reveal type="gt" default=<<x>> text="99" >
> <$text text= {{{[<x>addprefix[0]]}}} />
> </$reveal>
> </$list>
> \end
>
>
>
> --Mohammad
>

-- 
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/9fb7564e-e92f-4a06-901c-77cd685264a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to