If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!
Returns the number of words in a string.
function wordcount(string:String):Number {
var wrdArray:Array = string.split(" ");
for (var i = wrdArray.length; i>0; i--) {
if (wrdArray[i] == "") {
wrdArray.splice(i,1);
}
}
return wrdArray.length;
}
trace(wordcount("This will count the number of words"));
[...] bookmarks tagged flash Word Count saved by 4 others hsmfreak9 bookmarked on 02/17/08 | [...]
This function is good! Love it!