Click to See Complete Forum and Search --> : knock comma off end of displayed list of array names


kredd
09-01-2005, 11:17 AM
i'm creating an array that holds athletic team information.

here is my code for displaying the staff:


<b>Student Mngrs:</b>&nbsp;
<% for i = 0 to UBound(repPlayers,2) %>
<% if repPlayers(11,i) = "Student Mngr." Then %>
<a href="team.asp#<%= repPlayers(1,i) %>"><%= repPlayers(2,i) %></a>,&nbsp;
<% End If %>
<% Next %>


what i get is:
Student Mngrs: Billy Bob, Jane Bob,

how do i keep the last "," from showing up? i know how to do this if i was spitting out the whole array, but i'm stumped trying it with only part of the array.

thanks!
kelly

Bullschmidt
09-01-2005, 11:09 PM
Perhaps change this:

<a href="team.asp#<%= repPlayers(1,i) %>"><%= repPlayers(2,i) %></a>,&nbsp;

To be more like this:

<a href="team.asp#<%= repPlayers(1,i) %>"><%= repPlayers(2,i) %></a><% If i < UBound(repPlayers,2) Then %>,&nbsp;<% End If %>

russell
09-03-2005, 06:58 PM
do it like this

Dim u
u = Ubound(repPlayers, 2)

With Response
For i = 0 To UBound(repPlayers, 2)
.Write "<a href=""team.asp" & repPlayers(1, i) & """>" & repPlayers(2, i) & "</a>"
If i < u Then
.Write ", " & vbCrLf
End If
Next
End With

kredd
09-06-2005, 04:12 PM
thanks guys!