• Support
  • Articles
  • Resources
  • Products

Create Array from String with > 9 'Elements'

Moderator: boris

4 postsPage 1 of 1

stevo
Newbie

Posts:
19
Joined: Tue Oct 15, 2013 11:08 pm
by stevo » Mon Aug 25, 2014 2:06 am
Using this loop you can take a character separated string of elements up to the maximum Array Element Count and recursively break it into array elements:



It uses the StrSplit (string split) function to read the elements into temporary numbered variables 8 at a time until there are none left (strsplit works on up to 9 elements - you specify the character to use as the separator and if there are more than 9 the rest are all added to groupmatchstr9).

Once all elements have been read into a numbered variable, an array is created for the total number found and they are copied to the array.

Please test this and let me know if you find any mistakes!
HTH :)
IshmaelCallMe
Guru

Posts:
675
Joined: Thu Jan 26, 2006 2:28 am
by IshmaelCallMe » Thu Nov 05, 2015 6:47 pm
Fixed a minor bug.

Here is another solution:

IshmaelCallMe
Guru

Posts:
675
Joined: Thu Jan 26, 2006 2:28 am
by IshmaelCallMe » Thu Dec 03, 2015 5:40 pm
To use an actual array:

IshmaelCallMe
Guru

Posts:
675
Joined: Thu Jan 26, 2006 2:28 am
by IshmaelCallMe » Thu Dec 03, 2015 6:39 pm
Finally, here is a general purpose subroutine that will correctly dimension the array, will not eat the original line, and supports single or multiple character separators:

Display posts from previous:
Sort by:

4 postsPage 1 of 1

Users browsing this forum: No registered users
cron