optimized util string to array function