Splitting a word (String) into an array of letters (or characters)

What would be the easiest way to take a string and put it into an array where each element of the array is the letters of the word?

Example:
var word:String = “hello”;
var letter:Array = [“h”, “e”, “l”, “l”, “o”];

var word:String = "hello, world";
var letter:Array<String> = word.split("");
trace(letter);

["h", "e", "l", "l", "o", ",", " ", "w", "o", "r", "l", "d"]

Note that the comma and space get their own entries. If you don’t want that, you’ll have to filter them out.

2 Likes