Re: capitalizeFirstLetter ?
Re: capitalizeFirstLetter ?
- Subject: Re: capitalizeFirstLetter ?
- From: petite_abeille <email@hidden>
- Date: Thu, 23 Oct 2003 00:00:01 +0200
Hi Robert,
On Wednesday, Oct 22, 2003, at 23:42 Europe/Amsterdam, Robert A. Decker
wrote:
Since this is a major component of the behind-the-scenes working of
WebObjects I'm sure someone's written a highly eccifient method to do
this.
Well... "major component" may be overstating the case... but you could
try something along those lines...
if ( aString.length() > 0 )
{
char aChar = aString.charAt( 0 );
if ( Character.isUpperCase( aChar ) == true )
{
char[] someChars = aString.toCharArray();
someChars[ 0 ] = Character.toUpperCase( aChar );
return new String( someChars );
}
}
Don't know if this "highly efficient" one way or another though...
Alternatively, you may use want to use Apple's very own implementation
in _NSStringUtilities.capitalizedString().
And don't forget to run some benchmarks before committing to anything :)
Cheers,
PA.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.