Array To String Conversion


SteveMyres

Recommended Posts

Is there a direct way to convert an array to a single string?

I'm writing an array to a line in a file, and File.WriteDelim() works except that I want some other characters on the line, and WriteDelim() will terminate the line and not let me add the other characters. I also want some characters preceding the array on the line, but I can't File.Write() them, because that will terminate too. So if I can convert the array to a string, I can concatenate it with all the other stuff and do a single File.Write, which will terminate the line, but at that point that's fine.

Link to comment
Share on other sites

You mean, make {1,2,3} into "1, 2, 3" on one line? You'd have to do that with a loop. If you want them on separate lines, you might consider building up a multidimensional string array with your data, and then adding the ancillary stuff to that array, then using writeDelim().

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.