PDA

View Full Version : Simple question (i think) about arrays and strings


CerberusC
09-01-2009, 05:56 PM
I think it's a simple question:

Let's say i have an array

a= #(1,2,3,4,5)

No i turn this array into an string:

b= a as string
"#(1,2,3,4,5)"

Ok i have what i want, but in the end i want to turn this string into an array again, so how can i do that?

Cheers and thanks.

denisT
09-01-2009, 06:05 PM
I think it's a simple question:

Let's say i have an array

a= #(1,2,3,4,5)

No i turn this array into an string:

b= a as string
"#(1,2,3,4,5)"

Ok i have what i want, but in the end i want to turn this string into an array again, so how can i do that?

Cheers and thanks.


a = #(1,2,3,4,5)
b = a as string
c = execute b -- now it's an array


but you have to know that long arrays can't be correctly converted to a string... Check:

(for k=1 to 100 collect k) as string

CerberusC
09-01-2009, 06:44 PM
As i understand is up to 20 values, is it?

More than that mas will resume the count and will print it with three dots.

Is there a way to jump above that or it's a limitation of maxscript?

Cheers.

EricDLegare
09-01-2009, 06:47 PM
but you have to know that long arrays can't be correctly converted to a string... Check:

(for k=1 to 100 collect k) as string


Unless...
with printAllElements on
(
(for k=1 to 100 collect k) as string
)

CerberusC
09-01-2009, 06:52 PM
That's great! Thanks Eric.

CGTalk Moderation
09-01-2009, 06:52 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.