Convert String to array - "hello" > arr[0]="h"; arr[1]="e" ....

How can i convert string to array something like this :face_with_spiral_eyes:

var text : String = "hello";
var array : String[] = ConvertToArray(text);
// array[0]="h" array[1]="e" array[2]="l" array[3]="l" array[0]="o"

Did you mean:

array[4]="o"?

Also, may I ask why you need the string in array form?

A string is already an array; you don’t have to do anything:

var text = "hello";
print (text[0]);

–Eric

As Jesse pointed out, you can directly access the characters that way. If you still need it as a separate, independant array, you can use the String.Split or String.ToCharArray methods.