Very short snippet: cutString()

mercoledì 4 giugno, 2008

Utile e rapido! Con i valori Number di Actionscript, ad esempio, è un essenziale aiuto per il "print" a video.

Actionscript:
  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. }

Spesso lo uso anche in versione sub() o _s()

Post correlati

Questo articolo ti è stato utile?: Per nientePocoAbbastanzaMoltoMoltissimo
Loading ... Loading ...

Non ci sono commenti per questo Post

Lascia un commento

TAG XHTML PERMESSI: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> INSERIMENTO CODICE:
<pre></pre>         // blocco generico
[code][/code]       // blocco generico
[as][/as]           // Actionscript
[css][/css]         // CSS Style Sheet
[html][/html]       // HTML
[js][/js]           // Javascript
[objc][/objc]       // Objective-C
[php][/php]         // PHP
[sql][/sql]         // SQL