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:14:37 +0300

Sorry, I did a type while tried to explain my idea:


> -----Original Message-----
> From: Konovalov, Vadim [mailto:address@hidden
> Sent: Friday, February 11, 2000 1:09 PM
> To: address@hidden; Konovalov, Vadim
> Cc: Groff Mailing List; Eddie Maddox
> Subject: RE: [Groff] String editing?
> 
> 
> > 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/]
obviously should be 
.ds somestring \*[P:$str=~s/(\w+)/\L\u$1/g]
(Just copied the line and forgot to add 'g' modifier)

>  -- the same thing but for all words in the string!
> 
> There may be even more intresting things with this.
> 
> What do you think?
> 

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]