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 13:09:25 +0300

> On 11-Feb-00 Konovalov, Vadim wrote:
> > Sure there *are* string editing functions in groff:
> > .substring str \n[start] \n[end]  \" groff only
> > 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]
> > 
> Well, you are right, and one learns something all the time!
> 
> However, this is nowhere documented that I can see. How did 
> you find out?

Well, firstly I thought I saw this in [groff-x.xx]/troff/troff.man, but when
I checked this today I understood that there is no substring there. I
probably saw it in [groff-x.xx]/troff/input.cc. I can't recall correctly.

> (I knew about .as, but I don't regard this as prime-time string
> editing; the fundamental need is to unpack a string according to
> requirements, and "substring" is a fundamental primitive for this)
> 

Well, then, how about integrating Perl and groff together? I wrote about
this in my previous letter. I can't imagine that no-one intresting on this.
Just imagine something like:
.ds somestring \*[P:$str=~s/(\w+)/\L\u$1/]
to get result with first word changed to lowercase except it's first letter
which will be upcased
and 
.ds somestring \*[P:$str=~s/(\w+)/\L\u$1/]
 -- the same thing but for all words in the string!

There may be even more intresting things with this.

What do you think?

Vadim V.Konovalov, Software developer
ZAO Lucent Technologies, St.Petersburg branch
e-mail: address@hidden
phone:  +7(812)3298522


reply via email to

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