比如说我接收过来的字符串按逗号隔开,正常来说会有8个元素,但有时候发送过来的元素不够,只有7个或者6个,我要如何判断它不存在,然后给不存在的数组元素赋值.
以下是我的代码,测试过多种方法,都下标越界.
<%
str="金雅,他他中,4月19日,thikpad,7400元 ,崔"
dim strbd(9)
strbd=split(str,",")
for i =0 to 8
if strbd(i) = NULL then
strbd(i)="空"
end if
next
for j = 0 to 8
response.write strbd(j)&"<br>"
next
%>
UBound什么的也都用过了的
这样只能取到发过来的元素个数,要是只有6个,那我后面的就没有了,我要怎么样给strbd(6),(7),(8)赋值
追答这个,你不嫌麻烦的话,可以用另外的数组把这个数组装过来..虽然我觉得没什么实际意义..这个数组如果装的是你传进来的对象,你就没必要往这个对象里添加些没必要的东西...不过我不知道有没有类似的数据追加函数..因为我没遇到过这种情况