/ 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;
*If your string has special characters such as latin, add those characters to the r var. Just like var r:RegExp = /[^\wçà áâãèéêìÃîòóôõùúûüÀÃÇÂÃÈÉÊÌÃÎÒÓÔÕÙÚÛÜ¡]+/g;
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function splitString(str:String):Array { var r:RegExp = /\W+/g; return str.split(r)); }