In types and grammar, the author mentioned this briefly. In order not to switch from strings to arrays every time you use them, you can store strings as arrays rather than strings.
Here’s the quote:
The other way to look at this is: if you are more commonly doing tasks on your “strings” that treat them as basically arrays of characters, perhaps it’s better to just actually store them as arrays rather than as strings. You’ll probably save yourself a lot of hassle of converting from string to array each time. You can always call join("") on the array of characters whenever you actually need the string representation.
I would like to know some of the examples, and how to implement this… I get the idea of it, but I dont know a real world example that reflected his view. Do you guys do this just to save time? Is it a better practice just to save strings as arrays of characters? If so how to do it?
Thanks in advance.