turned a string into an array by creating a function