• home
  • blog
  • javascript
  • contact

Links

  • km0ti0n.blunted.co.uk

Recent Changes

  • /linux/setup/index
  • /linux/xen/xen-howto-ubunty-jaunty/index
  • /linux/xen/index
  • /linux/index
  • /cast/iron/guttering/cast-iron-guttering
  • /symantic-web/foaf
  • /css/opacity/index
  • /usenet/howto/index
  • /Goolge/IG/DomLookup/index
  • /pendrive/index
  • /linux/quickref/index
  • /home
  • /linux/sabayon/index
  • /win/server/MTU
  • /EventManagment/index
  • /win/win32_ssh_unix_utils
  • /linux/IEs4Linux
  • /css/CSS-Targeting-IE7
  • /pixel/index
  • /photography/index
  • /js/dragdrop/index
  • /js/Index
  • /js/mozXPath/index
  • /links/index
  • /css/rollovers
  • /linux/links
  • /about/index
  • /js/examples/Selects Value
  • /litestep/index
  • /sharpe/index
  • /js/examples/ComNum
  • /js/Printing/index
  • /Google/IG/Index
  • /links/Property
  • /OSX-Vmware/index
  • /EventFactoring/index
  • /js/ProperDOM/index
  • /js/examples/PropperDOM
  • /js/ajax/index
  • /Contact
  • /js/DefaultArgs/index
  • /js/examples/toCapatalize
  • /js/ObjFactory/Index
  • /js/examples/DynamicImage
  • /js/examples/Select's Value
  • /contact

toCapatalize

capitalize a String

String.prototype.toCapatalize = function()
{
   var rExp = /(\w)(\w*)/;
   var cResult="";
   aWords = this.Split(" ");
   for( var i = 0; i < aWords.length; i++ )
   {
      cResult += aWords[i].match( rExp)[1].toUpperCase() 
               + aWords[i].match( rExp)[2].toLowerCase() + " ";
   }
   return cResult;
}

As h3h pointed out my function "very inefficient". His version is alot more slick. http://beta.xkr.us/js-ucwords.html.

Last Updated : 28/12/2005 @ 15:50
0 Comment(s).

Valid XHTML 1.1

jsexamples

All trademarks and copyrights in this site are property of their respective owner.

Website design, graphics, textual content and code Copyright 2005 Andrew Scott. All rights reserved.