procmail
[Top] [All Lists]

Re: adding a character $N times to a given string

2004-03-20 05:13:10
Toen ik Robert Allerstorfer kietelde, kwam er dit uit:

what I currently want to do is to add the content of $CHAR (a
constant character) $N times (where $N is a positive integer number
like 5) to an existing string (lets say $STRING).

I do have a solution in mind, which would involve something acting as
a loop and re-calling itself $N times, but that seems a bit too
complex if there are existing simpler solutions. Ideas?

See http://www.xs4all.nl/~rvtol/procmail/snr/ 
specifically the rep.*

  rep_Inp01 = 27
  rep_Input = $CHAR
  INCLUDERC = rep.inc
  STRING = "${STRING}${rep_Return}"  rep_Return # unset

I will come up with a faster rep.inc later (which adds more 
CHARS per single loop, so needs less loops) but it works as is.

Feature: the minimum Return is 1 CHAR, even when Inp01 < 1. 

-- 
Affijn, Ruud

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>