On 8/1/06, Miguel Farah <[EMAIL PROTECTED]> wrote:
On 8/1/06, Niall Pemberton <[EMAIL PROTECTED]> wrote:
> On 8/1/06, Miguel Farah <[EMAIL PROTECTED]> wrote:
> > (I'm new here, so please be a little kind if I'm royally screwing up)
>
> Welcome :-)

Thanks.

>[...]
> > I think I can contribute new methods for string manipulation and text
> > formatting, but I need to know wether some of my utilities have been
> > considered previously and turned down, for any reason. Is there some
> > sort of log with this information?
>
> The best place to look is JIRA which we use for issue tracking:
>
>    http://issues.apache.org/jira/browse/LANG
>[...]

Great.

I looked at everything, trimmed/pruned my stuff, and now I'm down to a
few methods that haven't been done or proposed. I'll start with
something simple:

StringUtils has the repeat(String, int) method, which repeats a string
the given number of times.

1) I propose adding repeatToLength(String, int), which repeats the
   string enough times for the result to have exactly the given length.

   StringUtils.repeatToLength("abc", 9)  == "abcabcabc"
   StringUtils.repeatToLength("abc", 8)  == "abcabcab"

   A second method, repeatToLengthFromTheRight(String, int) cuts the
   possible excess at the beginning:

   StringUtils.repeatToLengthFromTheRight("abc", 9)  == "abcabcabc"
   StringUtils.repeatToLengthFromTheRight("abc", 8)  == "bcabcabc"

These seem like one-liners, using StringUtils.repeat and
StringUtils.trimToSize together (or something like that). ?

2) I propose adding repeat(char, int), which simply invokes
   repeat(String.valueOf(char), int). This makes it easier on the
   programmer, who doesn't have to do the conversion himself.

I can't see the harm in this one :) Easiest thing to do is to grab the
latest source code from svn, add your code and unit test and create
patches to put on a JIRA issue. Leave it without a fix-version, and it
can then be discussed for 2.3 or 3.0 inclusion.

Largely 3.0 inclusion means it has an API change, or it doesn't have
patch/unit-test :)

Hen

Hen

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to