Tinderbox Forum

Remove space character from every beginning of paragraph

I found a new application for Tindebox: clearing multilevel numeration in agreements to apply then my own numeration rules. Here is the coding for the stamp:

$ClearText=$Text.tr([0-9],x); $Text=$ClearText; $ClearText=$Text.replace (“x.”,""); $Text=$ClearText;

It worked perfect, but some paragraphs have extra spaces at the beginning. Could anyone suggest how to get rid of them using actions? I will appreciate any help.

As you set $Text to $ above you don’t actually need the ClearText attribute:

$Text=$Text.replace ("x.","");

This works for me

$Text = $Text.replace("^\ +", "").replace("\n\ +","\n");

This sets $Text to itself after two chained replace() operations. The first removes one or more literal spaces at the start of $Text (i.e. paragraph #1). The second operation covers the other paragraphs by looking for a line-break followed by one or more literal spaces and replacing that with just a line break (i.e removing the just the spaces).

I don’t believe you can collapse those two operations into one, but I’d be happy to be wrong.

I think some changes in the upcoming v9 might make this task a bit easier, or at least more intuitive, so by all means raise the subject again when v9 is out.

1 Like

Mark thank you for your reply. Both pieces of code worked perfectly. I am looking forward to v9.

1 Like

Raised !

The current public release is v8.9.2. v9 will be soon, but not yet!