removeprefix, addprefix, removesuffix, addsuffix with EMPTY input

33 views
Skip to first unread message

Mohammad

unread,
Feb 14, 2019, 3:12:54 AM2/14/19
to TiddlyWiki
It seems when the input to these operator is empty they still work!!


\define macz(xx, pp:"")
<$list filter="[<__xx__>removeprefix<__pp__>]">
Test: <<currentTiddler>>
</$list>
\end


<<macz xx:"abKIT-1" ab>>
<<macz xx:"abKIT-2" >>
<<macz xx:"abKIT-3" uu>>


Return:

Test: KIT-1

Test: abKIT-2 



Example 2 should return empty value!!

Is this a bug?

--Mohammad

Jeremy Ruston

unread,
Feb 14, 2019, 3:24:34 AM2/14/19
to tiddl...@googlegroups.com
Hi Mohammad

The removeprefix operator has no effect if the operand is blank: [[foo]removeprefix[]] equals "foo". It completely removes items in the input list that do not have the specified prefix.

Best wishes

Jeremy
--
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 tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
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/b5e7f2c4-3cd5-4e8a-a0ad-ed5b1eb2c116%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mohammad

unread,
Feb 14, 2019, 3:30:10 AM2/14/19
to TiddlyWiki
Thanks Jeremy!
 I got it. So the in my example the filter in list has a value and that was why it returned an output.

Cheers
Mohammad
Reply all
Reply to author
Forward
0 new messages