Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combining Elements of Array

Status
Not open for further replies.

tfayer

Technical User
Aug 4, 2002
41
US
If I use the Split function to create an array called aryName using " " as the delimitter, how do I combine the elements to give me each combination, including single elements, of the array.

For example the string "oooo nnnn eeee" would be split into
oooo
nnnn
eeee
I only want combinations that are next to each other and remain inorder.

The combinations would be:
oooo
nnnn
eeee
oooo nnnn
nnnn eeee
oooo nnnn eeee

For "a b c d" the result would be:
a
b
c
d
ab
bc
cd
abc
bcd
abcd

How do I determine the number of elements in an array.

Any help would be appreciated.
 
Looks like a set of fairly simple For...Next loops.
Get your array count
Set up second array
Set up an iteration counter
Set up outside For..Next (1 to arraycount) to determine number of elements to group
For..Next on the (outsidecounter) items into the second array, incrementing iteration counter as you go.

Number of elements in an array was answered in your other post
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top