输出数组的倍数为8

时间:2012-06-15 12:04:28

标签: html arrays string asp-classic

我有一个字符串,我用逗号分隔符分割并添加到数组中,现在我需要将数组排序为八的地址,前八个将是第一个地址,接下来的八个将是下一个地址,所以......要在html表中输出。建议

像这样......

id        addr1         addr2         addr3         add4
1         12 road       birmingham    westmid       u.k

objSoapClient.serviceForPostcodeStringBuilder(“AB10 1AF”)返回字符串。

<%
dim address
dim addArray

SET objSoapClient = Server.CreateObject("MSSOAP.SoapClient")
 objSoapClient.ClientProperty("ServerHTTPRequest") = True

Call objSoapClient.mssoapinit("http://ip address:56478/postcode/Service1.asmx?WSDL","Service1")
response.write(session("collp"))
address = objSoapClient.serviceForPostcodeStringBuilder("AB10 1AF")
addArray = Split(address,",")

%>

1 个答案:

答案 0 :(得分:1)

假设addArray的元素数是8的倍数。

Dim i
For i = 0 To UBound(addArray) Step 8
    %><tr><td><%=addArray(i)%></td><td><%=addArray(i+1>%></td><td><%=addArray(i+2)%></td></tr><%
Next

这里的关键功能是for循环中的Step 8 ..