Posted By

adrianparr on 04/29/10


Tagged

substr String char capitalize uppercase as3 first substring capitalise


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

tspitzr


AS3 Capitalise the First Letter of a String


 / Published in: ActionScript 3
 

  1. var myString:String = "hello";
  2. trace(myString);
  3. myString = catipaliseFirstLetter(myString);
  4. trace(myString);
  5.  
  6. function catipaliseFirstLetter($s:String):String {
  7. return $s.substring(0, 1).toUpperCase() + $s.substr(1, $s.length-1);
  8. }
  9.  
  10. // OUTPUT
  11. // hello
  12. // Hello

Report this snippet  

You need to login to post a comment.