Creating 2d arrays from strings


2D arrays are not a native type, so I don’t think you can build a 2D array from a string without using a Repeat. As the docs say: The Array2d compounds mimic an array of subarrays

So, here’s something I whipped out during my break from “real work” 🙂

3 thoughts on “Creating 2d arrays from strings

  1. You can do it with the modulo trick as well, avoiding the repeat with counter. I use the trick to load a 2D array of particles into a grid format. Convert the string to an array and select in array from there (row, column).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s