package{
import flash.display.Sprite;
public class Main extends Sprite{
public function Main(){
var example:String = "bRuCE";
trace( toInitialCap( example ) ); // Displays: Bruce
}
public static function toInitialCap( original:String ):String {
return original.charAt( 0 ).toUpperCase( ) + original.substr( 1 ).toLowerCase( );
}
}
}
|