Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 78958 invoked from network); 11 Nov 2002 04:19:18 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 11 Nov 2002 04:19:18 -0000 Received: (qmail 2901 invoked by uid 97); 11 Nov 2002 04:20:21 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@jakarta.apache.org Received: (qmail 2885 invoked by uid 97); 11 Nov 2002 04:20:21 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 2873 invoked by uid 98); 11 Nov 2002 04:20:20 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) Date: Sun, 10 Nov 2002 23:19:19 -0500 (EST) From: Henri Yandell X-X-Sender: To: Jakarta Commons Developers List Cc: Subject: [lang] StringUtils proposed methods Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N 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: For additional commands, e-mail: