Split string into Array


/ Published in: ActionScript 3
Save to your folder(s)

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;


Copy this code and paste it in your HTML
  1. function splitString(str:String):Array {
  2. var r:RegExp = /\W+/g;
  3. return str.split(r));
  4. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.