You might be able to achieve this using Groff's .while, .length, and .substring requests.
Not sure what use-case a substring's index could be in Roff though... On Fri, 24 Jul 2020 at 09:13, B 9 <hacke...@member.fsf.org> wrote: > Heirloom Troff has a handy string search function called .index which > works like this: > > .index R xx string > > The position where string occurs in xx is stored in register R. > > It doesn't seem to work yet in Groff, but I'm hoping somebody has a > macro that implements .index. > > Thanks, > > --b9 > >