commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Miguel Farah" <miguel.fa...@gmail.com>
Subject Re: [lang] After 2.2, what to add?
Date Tue, 01 Aug 2006 19:43:24 GMT
On 8/1/06, Niall Pemberton <niall.pemberton@gmail.com> wrote:
> On 8/1/06, Miguel Farah <miguel.farah@gmail.com> 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"


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.



-- 
Miguel Farah
miguel@farah.cl

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message