commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Henri Yandell <bay...@generationjava.com>
Subject RE: [lang] StringUtils overlay/concatenate/getNested
Date Fri, 01 Aug 2003 04:30:13 GMT


On Thu, 31 Jul 2003, Gary Gregory wrote:

> I am always for choosing better names.

Many of these names are my fault, as with much of StringUtils, and I'm
loving that the community part of open-source is paying off for me.
Smarter people are looking at my ideas with a different perspective and
massively improving them. Quite humbling in fact.

> >- overlayString - shouldn't have 'String' in name. Better named as
> 'replace'

But we already have a replace method? Unless I'm on crack, the
functionalities are quite different. Overlay takes a text and effectively
replaces based on a set of indexes, rather than replacing characters.

+1 to removing String
-0 to replace
+0 to another name than 'overlay'

> >- concatenate - does the name as join(array, null) so should be called
> join(array)
>
> I cannot say I am fond of the whole 'join' terminology. It seems to
> math-like for String objects (as opposed to Sets). Since strings are 'added'
> together with '+', has 'add' been proposed? Not a great choice I know.
>
> +0

My only problem with join is something someone pointed out to me not long
after I accepted that 'join' was more Java than the explode/implode I'd
used elsewhere. They pointed out that Java already has a join method on
every Object. So in effect we're overloading a threading method. Kinda.

Having join(array) makes more logical sense, but I also think that people
might be looking for a 'concat' style of function.

+0 too. I feel people will complain, but it does seem the right choice.

> >- getNestedString - poor name, again with String in it.
>
> 'Nested' seems wrong to me. This is just a 'substring'-type of operation,
> how about 'substringBetween'? We already have 'substringAfter' and
> 'substringBefore', so this seems to fit just, well, just between. ;-)

+1 to substringBetween.

It's not sexy, but it does help to group the method nicely with the
substring collection.

Hen


Mime
View raw message