Re: String Replace Backwards


loro
 

Axel Berger wrote:
Unless I'm very wrong and miss the obvious, ^$StrReplace()$ has a
serious
limitation compared to ^!Replace, it can't search backwards from the
end.

In the actual case I came across just now that's no real problem. I can
use
^Replace H and follow up with a new ^!Select PARAGRAPH. But in the
general
case restoring the selection is not as simple as that and doing several
things to one selection is quite common for me.

Is there any way to transfer
^!Replace ", " >> " \& " HBSTI
to working on a variable?

(In case you wonder, this is about the last comma in a list of authors.
And
yes, I know that TI are both superfluous here, but they are my base
standard and typed by default.)


Axel, I'm very rusty and I'm not up do date with new additions to the clip language. Probably there are better ways, but here's how I used to do it, step by step. Find the index number of the comma, delete the comma, inject the & in its place.

^!Set %axel%=Goethe,Mann,Hesse
^!Set %pos%=^$StrPosRight(",";"^%axel%";false)$
^!Set %axel%=^$StrDelete("^%axel%";^%pos%;1)$
^!Set %axel%=^$StrInsert("&";"^%axel%";^%pos%)$

Lotta

--
Computer says no.

Join Clips@Notetab.groups.io to automatically receive all group messages.