groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Groff] String editing?


From: Konovalov, Vadim
Subject: RE: [Groff] String editing?
Date: Fri, 11 Feb 2000 09:32:18 +0300

> -----Original Message-----
> From: address@hidden 
> On 10-Feb-00 Eddie Maddox wrote:
> > How is string editing done? The Groff manual, ed. 1.12, Oct'99,
> > is lacking that info, I think.
> > 
> > Ex:
> > .<align or .<href or .<alt, etc.
> > then:
> > \\$0    == "<align" or "<href" or "<alt", etc.
> > so: how do I strip the "<" so I can use just the "align" later on?
> 
> You don't -- at any rate not in groff. There are no string-editing
> functions in groff.

Sure there *are* string editing functions in groff:
.substring str \n[start] \n[end]  \" groff only
.as ...... \" both troff and groff

Consider following test:
.ds str <this
.tm [\*[str]]
.ds sstr \*[str]
.substring sstr 2
.tm [\*[sstr]]
.ds sstr \*[str]
.substring sstr 2 3
.tm [\*[sstr]]

this outputs following on STDERR:
[<this]
[this]
[t]

If \n[start] or \n[end] are negative values then position in macro/string is
calculated from its end

Not as powerful as Perl string editing functions are, but ....
I am thinking about merging Perl and Groff together to get really powerful
string manipulation in groff, even search/replace regexes will be made
easily in this case. Is anyone intresting on this, or I am alone on this?
Should I really do this work? (I tested Perl and groff coexistence, first
tests were Ok, but I'm not sure it is really useful)

Good luck,
Vadim Konovalov.
use strict;%;=qw;. @ @ .;,;$;=q;@;,$,=qq>\n>=>print
unpack q,A28,x6,join q,,,map{;$;=$;{$;};$;x$_;}split q,,,q
<13321523136131112131213171212121312131711524355111113121613132111316431322>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]