Martin Stjernholm, Roxen IS @ Pike developers forum wrote:
Hmm, I almost never pick strings apart into individual characters since I believe it's slow (although I really haven't measured). I usually manage to do it in ways where the individual char picking is kept at the C level (sscanf ftw).
When parsing structures which can extend over newlines and/or support wierd quoting rules (like csv), it's almost inevitable.
The result is that I would like to accumulate the results piecemeal in an array. This array gets filled like in the example above. Then I'd like to return a single string to the function caller, in which case I could cast it to string (as done above).
And you can't use String.Buffer for it? It has add() for strings and putchar() for chars.
I didn't know String.Buffer existed. Looks interesting (and useful).