Actually, this raises an interesting point - the split[] operator with no 
argument produces a space delimited list of single characters, but this 
list does not have the usual uniqueness property of other filter lists and 
it can include a space as an item .  How can a space be an item in a space 
delimited list?  This behaviour can be demonstrated in the following 
examples:

<$list filter="[[a string with spaces]split[]join[]]"/>

Produces: "a string with spaces", with spaces and duplicate characters 
preserved, and:

<$list filter="[[a string with spaces ]split[]join[-]]"/>

Produces: "a- -s-t-r-i-n-g- -w-i-t-h- -s-p-a-c-e-s- ", including the space 
on the end.  Hence Mohammad's need to add the trim[] operator.

[[1111]split[]sum[]]

Gives an answer of 4, while:

"1 1 1 1" +[sum[]]

Gives an answer of 1 because duplicates are eliminated from the list.

I wonder if this behaviour is by design, or could it change in the 5.1.20 
release or future versions, thus causing these types of hacks to fail.

Mal


On Tuesday, 19 February 2019 05:34:02 UTC+10, Mohammad wrote:
>
> Mark,
>  I changed the below line
> <$list filter="""[<item>split[]rest[$n$]join[]]""" variable="newTitle">
>
>
>
> as
>
> <$list filter="""[<item>split[]rest[$n$]join[]trim[]]""" 
> variable="newTitle">
>
> seems I can overcome leading and trailing spaces! Thanks to TW5.1.20 
> string operators.
>
> --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/e4b9ba38-6b4f-40bf-8815-03b8f65b3e1f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to