We Recommend

Essential ActionScript 3.0 Essential ActionScript 3.0
The book focuses on the core language and object-oriented programming, but also adds a deep look at the centerpiece of Flash Player's new API: display programming. Enjoy hundreds of brand new pages covering exciting new language features, such as the DOM-based event architecture, E4X, and namespaces--all brimming with real-world sample code.


Posted By

gfazioli on 06/04/08


Tagged

utilities


Versions (?)


Who likes this?

1 person has marked this snippet as a favorite

gfazioli


Very short snippet: cutString()


Published in: ActionScript 3 


URL: http://www.undolog.com/2008/06/04/very-short-snippet-cutstring/

  1. /*
  2. ** @name : cutString()
  3. ** @description : cut a string for n chars
  4. */
  5. protected function cutString(s:String, v:uint = 4):String {
  6. return ( (s.length> v)?s.substr(0,v):s );
  7. }

Report this snippet 

You need to login to post a comment.