28,390
社区成员
发帖
与我相关
我的任务
分享
<%
a = "2008-12-19|1000,2008-12-20|2000,2008-12-21|3000"
b = "2008-12-20|1500,2008-12-21|2000"
arr = Split(a, ",")
For I = 0 To UBound(arr)
temp = Split(arr(I), "|")(0) & "|"
If InStr(b, temp) = 0 Then b = b & "," & temp & "null"
Next
arr = Sort(Split(b, ","))'冒泡排一下序就OK了
b = Join(arr, ",")
response.write b
Function Sort(a)
blnChk = True
Do Until blnChk = False
blnChk = False
For I = 0 To UBound(a)
If I = UBound(a) Then Exit For
If a(I) > a(I + 1) Then
FirstValue = a(I)
SecondValue = a(I + 1)
a(I) = SecondValue
a(I + 1) = FirstValue
blnChk = True
End If
Next
Loop
Sort = a
End Function
%>
<%
a = "2008-12-19|1000,2008-12-20|2000,2008-12-21|3000"
b = "2008-12-20|1500,2008-12-21|2000"
arr = Split(a, ",")
For i = 0 To UBound(arr)
temp = Split(arr(i), "|")(0) & "|"
If InStr(b, temp) = 0 Then
if right(b,1)="," then
b = b & temp & "null"
else
b=b & "," & temp & "null"
end if
end if
Next
response.write b
%>
Dim a
Dim b
a = "2008-12-19|1000,2008-12-20|2000,2008-12-21|3000"
b = "2008-12-20|1500,2008-12-21|2000"
Dim col_a
Dim col_b
set col_a =server.createobject("Scripting.Dictionary")
set col_b =server.createobject("Scripting.Dictionary")
Dim arr_a
Dim arr_b
Dim arr_tmp
If Len(a) <> 0 Then
arr_a = Split(a, ",")
End If
If Len(b) <> 0 Then
arr_b = Split(b, ",")
End If
Dim mydata
Dim xx
For xx = 0 To UBound(arr_a)
arr_tmp = Split(arr_a(xx), "|")
col_a.Add arr_tmp(0),arr_tmp(1)
Next
For xx = 0 To UBound(arr_b)
arr_tmp = Split(arr_b(xx), "|")
col_b.Add arr_tmp(0),arr_tmp(1)
Next
dim yy
yy=col_a.keys
For xx = 0 To col_a.Count-1
If col_b.exists(yy(xx)) Then
col_a.item(yy(xx))=col_b.item(yy(xx))
else
col_a.Item(yy(xx)) = "null"
End If
Next
For xx=0 to col_a.count-1
response.write(yy(xx)+"|"+col_a.item(yy(xx))+",")
next
public string aaa()
{
string a = "";
string b = "";
string[] atemp=a.Split(',');
string[] atime;
string[] btemp = b.Split(',');
string[] btime;
string temp = "";
for (int i = 0; i < atemp.Length; i++)
{
atime = atemp[i].Split('|');
int jtemp=-1 ;
for (int j = 0; j < btemp.Length; j++)
{
btime = btemp[j].Split('|');
if (atime[0] == btime[0])
{
jtemp=j;
}
}
if (jtemp!=-1)
{
if (i == 0)
{
temp = btemp[jtemp];
}
else
{
temp =temp + "," + btemp[jtemp];
}
}
else {
if (i == 0)
{
temp = atime[0]+"|"+"null";
}
else
{
temp = temp + "," + atime[0] + "|" + "null";
}
}
}
return temp;
}
<%
a = "2008-12-19|1000,2008-12-20|2000,2008-12-21|3000"
b = "2008-12-20|1500,2008-12-21|2000"
arr = Split(a, ",")
For i = 0 To UBound(arr)
temp = Split(arr(i), "|")(0) & "|"
If InStr(b, temp) = 0 Then b = b & temp & "null"
Next
response.write b
%>