• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: capitalizeFirstLetter ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >capitalizeFirstLetter ? (From: "Robert A. Decker" <email@hidden>)

  • Prev by Date: WebObjects and Search Speed
  • Next by Date: Re: WebObjects and Search Speed
  • Previous by thread: capitalizeFirstLetter ?
  • Next by thread: wait, nevermind
  • Index(es):
    • Date
    • Thread