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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Array Elements

Status
Not open for further replies.

DANZIG

Technical User
Mar 8, 2001
142
US
Hellos,

I'm trying to figure out how access a range of array elements. I'm familiar with perl and in perl I would use a statement like the one below.

@names=("Muriel","Gavin","Susanne","Sarah","Anna","Paul","Trish","Simon");

print "The first two elements are @names[0,1]\n";
print "The first three elements are @names[0..2]\n";


@names[0,1]
lets me access the values of the first two array elements as a simple range statement. Does vbs have anything similar and if not how would you go about accessing the values in the array? I'm implementing this with in a for each loop also.

Thanks in advance.
 
I'm unaware of anything built in to do this. The
Code:
Join( )
function will do this for the whole array. For a range of elements I'd write a simple
Code:
Function
to return the concatenated values.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top