Posted By

izaiasdotcom on 03/09/12


Tagged

array String split Vector


Versions (?)

Split string into Array


 / Published in: ActionScript 3
 

Easily breaks a string into an array of words.

*If your string has special characters such as latin, add those characters to the r var. Just like var r:RegExp = /[^\wçàáâãèéêìíîòóôõùúûüÀÁÇÂÃÈÉÊÌÍÎÒÓÔÕÙÚÛÜ¡]+/g;

  1. function splitString(str:String):Array {
  2. var r:RegExp = /\W+/g;
  3. return str.split(r));
  4. }

Report this snippet  

You need to login to post a comment.