How to split all chars from string array

Don’t use split(s, "") to get “characters” — that returns 1-character strings, but Julia (unlike Python) has an actual character type. Use collect to get an array of characters.

(That being said, it’s rare to actually need to explicitly collect an array of characters during string processing — you can just loop over the characters directly. Unlike other dynamic languages, you don’t have to cram everything into “vectorized” operations to get good performance; often non-vectorized code is clearer and faster.)

12 Likes