SteveMyres Posted June 26, 2014 Share Posted June 26, 2014 If MyStringArray == {"A", "B", "C"}, I can't seem to figure out a way to store that entire array in a single string. I tried evaluate(Chr(94) + MyStringArray + Chr(94)), the same string just as a string add without evaluate(), and Chr(96) instead of 94. Is there a way to do this? Guess I could Unparse it, using some delimiter unlikely to appear in the strings. Link to comment Share on other sites More sharing options...
AzeoTech Posted June 26, 2014 Share Posted June 26, 2014 If the values in myStringArray are actually single characters and not multicharacter strings, you can do: chra(asc(myStringArray)) I'm assuming of course you want to get "ABC" out of the sample you provided. Not sure what you are doing with evaluate and chr(94). Chr(94) is a caret ^ Link to comment Share on other sites More sharing options...
SteveMyres Posted June 26, 2014 Author Share Posted June 26, 2014 No, I'm trying to get the string "{"A", "B", "C"}", or '{"A", "B", "C"}'. I want an array encoded into a string that I can parse back into an array later, presumably using evaluate(). The 94 is the result of my old guy eyes looking at an ASCII table. I was tryig to use single and double quotes around the array. Link to comment Share on other sites More sharing options...
AzeoTech Posted June 26, 2014 Share Posted June 26, 2014 For quotes its better to do: "'" or '"' Which look the same. The first is double quote, single quote, double quote. The second is the reverse. I still don't understand what you are trying to do, or why. However, if I understand you right, the way to do it is to use an object and use toJson() and fromJson(). You'll get some extra data in the string, but it will be just a single string that you can then reinstantiate back into the object / array. Link to comment Share on other sites More sharing options...
SteveMyres Posted June 26, 2014 Author Share Posted June 26, 2014 Thanks. What I'm trying to do is make an array of arrays. IOW, the strings get put into a 1D string array. The other arrays are of varying lengths and I don't want the container array resizing all the dimensions to match. In fact some of the individual strings will contain 2D arrays. So I want a 1D array of strings which encode 1 or 2D arrays of various sizes. There end up being a variable number of these strings, so otherwise I'd need to generate temp names, and then remember how many there were. Easier to just pack them in an array, the rows of which end up being a to-do list for the next step. Link to comment Share on other sites More sharing options...
AzeoTech Posted June 26, 2014 Share Posted June 26, 2014 Use objects. Link to comment Share on other sites More sharing options...
SteveMyres Posted June 26, 2014 Author Share Posted June 26, 2014 Alright, thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.