Mark,
 String operation are added to TW - prerelease, see below

Ref: 

   - 
   
https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/filters/strings.js
   - 
   
https://github.com/Jermolene/TiddlyWiki5/commit/9b2d52716a24197ba9fd67b708cbe2c56fa1b5d0


By the way, please let me know your opinion on the above macros.

--Mohammad

On Friday, February 15, 2019 at 7:57:17 PM UTC+3:30, Mark S. wrote:
>
> Like others in the forum, I'm finding that search links do not work. You 
> had a post earlier (which I can't get to) about new string operators being 
> added in the pre-release. But there's no documentation for string operators 
> -- only the new math operators.
>
> I'm wondering if, with the new string operators, it would be possible to 
> make a simpler, more concise padding macro that could provide any level of 
> padding?
>
> Could you share any information or documentation you've uncovered about 
> the string operators?
>
> Thanks!
> -- Mark
>
> On Friday, February 15, 2019 at 8:18:05 AM UTC-8, 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/9b4b3fee-e4d0-4803-92dc-2b4f1fca9051%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to