commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Henri Yandell <bay...@generationjava.com>
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
the
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
previous
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.

""+(char)NumberUtils.stringToInt("31");

or something??

+++++++++++++++++++++++++++++++++++++++++++++++
SQL
===


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

+++++++++++++++++++++++++++++++++++++++++++++++

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

+++++++++++++++++++++++++++++++++++++++++++++++

getSqlColumnValueOrNull( String s ) : String /** Returns s or the String
"null"
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?

Hen


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


Mime
View raw message