I'm sending a string to a page that looks like this:
CalMiles_MS.asp?s0=Chicago,IL&s1=Akron,OH&s2=,EMPTY&s3=,EMPTY&s4=,EMPTY&s5=,EMPTY&s6=,EMPTY&s7=,EMPTY&s8=,EMPTY&s9=,EMPTY&s10=,EMPTY&s11=,EMPTY&s12=,EMPTY&s13=Des Moines,IA&s14=,EMPTY&s15=,EMPTY&s16=,EMPTY&s17=,EMPTY&s18=,EMPTY&s19=,EMPTY&s20=,EMPTY&s21=,EMPTY&s22=Miami,FL&s23=Dallas,TX
but in that "CalMiles_MS.asp" page I would like to remove all of the ",EMPTY" and re-order the "&s" + Number(s) so when complete the above example would look like this:
CalMiles_MS.asp?s0=Chicago,IL&s1=Akron,OH&s2=Des Moines,IA&s3=Miami,FL&s4=Dallas,TX
How can I do that ?
Please help, Thanks.
EDIT:
<%
Dim key
Dim qstr
Dim count: count = 0
Response.Write "<p>Input:<br />" & Request.Querystring & "</p>"
for each key in Request.Querystring
If Request.Querystring(key) <> ",EMPTY" Then
qstr = qstr & "&s" & count & "=" & Request.Querystring(key)
count = count + 1
End If
Next
If qstr <> "" Then
qstr = Right(qstr, Len(qstr) - 1)
End If
Response.Write "<p>Output:<br />" & qstr & "</p>"
%>
But the problem now is NOT that it does not keep the S's (S#) in order, that works fine now, but the City,States are not in the correct order:
&s1......,.......&s2......,.......&s3......,.......
How can I sort them numerically and keep the order the same (city,state) ?
My Test Query Input:
s0=Columbus,OH&s1=,EMPTY&s2=,EMPTY&s3=Chicago,IL&s4=,EMPTY&s5=,EMPTY&s6=,EMPTY&s7=,EMPTY&s8=Akron,OH&s9=,EMPTY&s10=,EMPTY&s11=Plainfield,IN&s12=,EMPTY&s13=Miami,FL&s14=,EMPTY&s15=,EMPTY&s16=,EMPTY&s17=,EMPTY&s18=,EMPTY&s19=,EMPTY&s20=,EMPTY&s21=Memphis,TN&s22=Denver,CO&s23=Dallas,TX
Output:
s0=Columbus,OH&s1=Chicago,IL&s2=Miami,FL&s3=Plainfield,IN&s4=Dallas,TX&s5=Memphis,TN&s6=Akron,OH&s7=Denver,CO
but the output should be:
s0=Columbus,OH&s1=Chicago,IL&s2=Akron,OH&s3=Plainfield,IN&s4=Miami,FL&s5=Memphis,TN&s6=Denver,CO&s7=Dallas,TX