|
-
Aug 28th, 2000, 08:23 AM
#1
Thread Starter
New Member
Hi:
I'm new to VB (about a week). I'm writing something in excel to sort some reference designators for circuit boards. What I need to do is get this:
C1, C8, C2, C6, C12, C3
to this:
C1-3, C6, C8, C12
I'm pretty close except for one last thing that's driving me mad. I have all the numbers stored in an integer array like this:
1,2,3,6,8,12
I need to compress them to an array of strings like this:
1-3
6
8
12
After that I can stick the C's back on no problem. All the arrays have to be dynamically sized of course. This program would save people time here, cause doing this by hand really sucks!
more examples in case that wasn't clear:
1,5,7,8,9,10,23 ---> 1,5,7-10,23
1,2,3,4,23,67,68,69 ---> 1-4,23,67-69
I've worked on this for a awhile and anything I come up with gets really complex quickly. There has to be an elegant way to do this, I'm just missing it somehow.
any ideas?
thanks,
edchainsaw
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|