How to remove ALL whitespace using a filter?

34 views
Skip to first unread message

Hubert

unread,
Dec 2, 2019, 10:18:33 AM12/2/19
to TiddlyWiki
Hello,

I'm looking for something beyond trim, a filter operator that would remove all spaces from an input (not just trailing spaces), like here:

<$list filter="[[a black cat hides under a chair]whitespaceremove[]]">
<<currentTiddler>>
</$list>

Where the output would ideally be: ablackcathidesunderachair

Is this possible?

Thank you,
Hubert

Diego Mesa

unread,
Dec 2, 2019, 10:43:05 AM12/2/19
to TiddlyWiki
Hey Hubert,

Unless Im missunderstanding something, you can use the split operator and the join operator to accomplish this:

<$list filter="[[a black cat hides under a chair]split[ ]join[]]">
<
<currentTiddler>>
</$list>

returns: ablackcathidesunderachair

Hubert

unread,
Dec 2, 2019, 11:03:52 AM12/2/19
to TiddlyWiki
Thank you Diego.

A follow up question, is it possible to detect if a string is only whitespace? As in, "    "? Such "string" would consist of no characters but at the same time it would not evaluate to nothing, so the following reveal syntax would not detect it:

<$reveal state="!!input" type="nomatch" text=""/>

I feel this could be accomplished with regex, but I'm no expert. What I'm trying to do is foolproof my text inputs against accidental empty strings because the consequences are not elegant so to speak :)

Thank you again,
Hubert
Reply all
Reply to author
Forward
Message has been deleted
0 new messages