toTitleCase( ) converts a string to title case (initial letters capitalized) : Case : String Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » String » Case »

 

toTitleCase( ) converts a string to title case (initial letters capitalized)


 

package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){

        var example:String = "the actionScript cookbook";
        
        tracetoTitleCaseexample ) );


    }
    public static function toTitleCaseoriginal:String ):String {
      var words:Array = original.split" " );
      for (var i:int 0; i < words.length; i++) {
        words[i= toInitialCapwords[i] );
      }
      return words.join" " ) );
    }
    public static function toInitialCaporiginal:String ):String {
      return original.charAt).toUpperCase(  ) + original.substr).toLowerCase(  );
    }    
  }
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo String
» Case