You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Chuck Daniels <cj...@yahoo.com> on 2003/11/25 02:41:57 UTC

RE: [lang] new functionality in StringUtils and ArrayUtils - prop osal 01

Forgive me for jumping into the middle of this thread, but doesn't
String.concat obviate the need for append/prepend/trail/lead?  [My apologies
if this was covered much earlier in this thread.]

> -----Original Message-----
> From: Gary Gregory [mailto:ggregory@seagullsw.com]
> Sent: Tuesday, November 25, 2003 9:23 AM
> To: 'Jakarta Commons Developers List'
> Subject: RE: [lang] new functionality in StringUtils and ArrayUtils -
> prop osal 01
>
>
> Having both an append and a prepend method seems redundant to me since all
> one to do is switch arguments around to get the same result. It also seems
> that an append method could be implemented with StringUtils.join(). These
> are all the same:
>
> StringUtils.append("a", "b") = "ab"
> StringUtils.prepend("b", "a") = "ab"
> StringUtils.join(new String[]{"a", "b"}) = "ab"
>
> I suppose append() could be a nice shortcut for join()...
>
> Gary
>
> > -----Original Message-----
> > From: Charles Hudak [mailto:CHudak@arrowheadgrp.com]
> > Sent: Monday, November 24, 2003 16:51
> > To: 'Jakarta Commons Developers List'
> > Subject: RE: [lang] new functionality in StringUtils and
> ArrayUtils - prop
> > osal 01
> >
> > Oh, and by the way, the method signature would probably look like this:
> >
> > public String append(String base, String suffix){...}
> > public String prepend(String base, String prefix){...}
> >
> > -----Original Message-----
> > From: Charles Hudak [mailto:CHudak@arrowheadgrp.com]
> > Sent: Monday, November 24, 2003 16:48
> > To: 'Jakarta Commons Developers List'
> > Cc: 'equinus100@Hotmail.com'
> > Subject: RE: [lang] new functionality in StringUtils and ArrayUtils -
> > prop osal 01
> >
> >
> > The ideas of 'flank' and 'lead' are better suggested through the use of
> > the
> > terms "append" and "prepend".
> >
> > When you 'flank' "abc" with "def" you are appending the string
> "abc" with
> > "def"
> > StringUtils.append("abc", "def"); //-->"abcdef"
> >
> > When you 'lead' "abc" with "def" you are prepending the string "def" to
> > "abc"
> > StringUtils.prepend("abc", "def"); //-->"defabc"
> >
> >
> >
> >
> > -----Original Message-----
> > From: ASHWIN Suresh [mailto:a.suresh@sigmatel.net.ma]
> > Sent: Monday, November 24, 2003 16:43
> > To: 'Jakarta Commons Developers List'
> > Cc: 'equinus100@Hotmail.com'
> > Subject: RE: [lang] new functionality in StringUtils and ArrayUtils -
> > prop osal 01
> >
> >
> >
> >
> > -----Original Message-----
> > From: Gary Gregory [mailto:ggregory@seagullsw.com]
> >
> > >   StringUtils.flank(String flankee, String flank)
> > >   StringUtils.flank(String flankee, char flank)
> >
> > > I am not fond of the word "flank", it is not part of my string
> > manipulation
> > vocabulary, maybe it is a Perl thing? I think "wrap" or your other
> > "enclose"
> > is *much* better for things like that.
> >
> > [Ash]
> > I proposed the term "flank" simply because the concept is that of
> > flanking,
> > and
> > I don't know if it has been used in any string manip jargon.
> Wrap already
> > has
> > a specific significance, and I am trying to get a fine
> distinction between
> > "flank" and "enclose".
> >
> >
> >
> >
> > >   * StringUtils.flank("", *)        = *
> >
> > This one does not seem quite right:
> >
> > StringUtils.flank("", "x") = "x"
> >
> > > Should it not be = "xx"?
> >
> > [Ash]
> > Sorry, yes, it should be "xx". Mea culpa.
> >
> >
> >
> > >   /**
> > >    * <pre>
> > >    * StringUtils.doubleQuote("Now is the time...") = "Now is the
> > time..."
> > >    * </pre>
> > >    */
> > >   StringUtils.doubleQuote(String quotee)
> >
> > > The edge cases are not specified in the above. An @see could
> also do be
> > added to avoid duplicating the edge case docs.
> >
> > >   StringUtils.lead(String leadee, String leadChar)
> >
> > hmmm... "abc" + "zz" = "zzabc"
> >
> > [Ash]
> > Because "abc" is 'lead' by "zz".
> >
> >
> > > Unless you want to handle edge cases specifically this seems over the
> > top...
> >
> > Gary
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>


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