Very short snippet: cutString ()

Useful and fast! With the values Number of Actionscript, for example, is an essential aid for the "print" on video.

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

Often I use it also in sub() and _s()

There are no comments for this post

Leave a comment

TAG XHTML PERMITS: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> INSERTION CODE:
 <pre></pre> // blocco generico <code></code> // blocco generico [cc_actionscript][/cc_actionscript] // Actionscript [cc_actionscript3][/cc_actionscript3] // Actionscript 3 [cc_css][/cc_css] // CSS Style Sheet [cc_html][/cc_html] // HTML [cc_js][/cc_js] // Javascript [cc_objc][/cc_objc] // Objective-C [cc_php][/cc_objc] // PHP [cc_sql][/cc_sql] // SQL 


Stop SOPA