commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Henri Yandell <>
Subject [lang] StringUtils proposed methods
Date Mon, 11 Nov 2002 04:19:19 GMT
Going over Ken Fitzpatrick's suggested new methods:

getClassNameOnly( Object o ) : String =>  ClassUtils.getClassNameOnly. DONE


getNumerics( String s ) : String /** Returns only the numeric contents of s */


getProperCase( String s ) : String /** Returns proper-case equivalent of
contents of s (ex: return "Bob Smith" from "bob smith") */


getBoolean( String s ) : boolean - Already Added :) DONE. Doesn't do t/f,
y/n, 1/0, +/-, Yep/Nope etc.


getTrueOrFalse( boolean b ) : String /** Returns the equivalent of b as
either "True" or "False" */  ... other methods to support inverse of
method (ex: getYesOrNo, getOnOrOff, etc.)

I guess. Seems a bit weak :) I'm not a big ternary fan, but:

b ? "Yes" : "No"   seems simple. Or a simple if/else. Or ChoiceFormat?

Dunno. N methods seem a bit poor. And ""+b will give true/false.


concatWithConditionalIntermediate - Ordinarily I'd have pooh-poohed this
one. But it's the second time it's been suggested. It's basically a join
that handles empty elements specially.


getHexCharsToByteArray. This was around. ByteArrays class. I've got it
still sitting on my local repo. I think it went to Lang from Util then to
Codec or something silly. I still think it's useful, but it's been vetoed
in the past.

getValueSubstitutedString. This is an instance of Interpolator in
Commons-Sandbox Util.


getDumpFormat. I thought this was in Util, or Codec, or somewhere..
HexDump class.


getCharValue - Turn a String like "31" into the character that equals,
"1". I think this is too specific, and not hard to do anyway.


or something??


getSqlEscapedColumnValue( String s ) : String /** Returns an SQL-based
equivalent of s (ex: map "Bob's" to "Bob''s", etc.) */


getSqlWhereEqualsColumnValueOrIsNull( String s ) : String /** Returns "=
(if s != null) or "is null" (if s == null) for safely building SQL Where
Predicates like "ColumnName = 'Bob'" or "ColumnName is null" */


getSqlColumnValueOrNull( String s ) : String /** Returns s or the String
such that the returned value can be used to safely build an SQL Update.Set
Clause, Insert.Values Clause, etc. as "Set Col=[s]" where s is the value
returned from this method ... Overloads for Date, Integer, ... */

I'm interested in all three of these Sql methods being added to DbUtils in
the Commons-Sandbox :) Could you provide your implemetnations Ken?


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message