groff
[Top][All Lists]
Advanced

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

Re: [Groff] String editing?


From: Dean Allen Provins
Subject: Re: [Groff] String editing?
Date: Fri, 11 Feb 2000 09:21:32 -0700 (MST)

Werner:

The 'length' macro will be nice (as will the documenting of the
substring macros.  Would you also consider adding one which returns
TRUE or FALSE if the string is a numeric (optionally preceded by a
plus or minus sign) or not?

I've hacked some code in 'ms' to do that, but it only tests if the
'string' is bigger or smaller than some value.  It assumes an ASCII
collating sequence.  I suspect it is not too dependable.  i

I need it to check macro argument types - sort of an error check to
ensure that I get a numeric when I expect a numeric.

Thanks,

Dean Provins
Calgary

> 
> > 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]
> 
> Of course completely undocumented...  I'll add some docs to troff.man
> and groff.texinfo.
> 
> I will also soon include a `length' macro which computes the length of
> a string.
> 
> > 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)
> 
> What do you mean with `merging'?  Adding Perl's string functions to
> groff?  This is a good thing, I think -- the only question is to which
> extent...
> 
> Or do you mean writing a macro package to access Perl's string
> manipulation functions from within groff?  This is also very nice, but
> somewhat limited since you have to use groff's `-U' switch.
> 
> 
>     Werner
> 
> _______________________________________________
> Groff maillist  -  address@hidden
> http://ffii.org/mailman/listinfo/groff
> 



reply via email to

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