请教asp数组倒置的问题?

来源:百度知道 编辑:UC知道 时间:2024/06/03 03:46:40
请问怎样用ASP程序把str="123,456,789"倒置成str="789,456,123"呢?

用StrReverse倒序函数
<%
str="123,456,789"
response.write StrReverse(str)
%>
或者
<%
str="123,456,789"
sstr=split(str,",")
str_s=sstr(2)&","&sstr(1)&","&sstr(0)
response.write str_S
%>

<%
function ReverseString(str,splitStr)
if isnull(str) or isempty(str) or str = "" then
ReverseString = ""
exit function
end if
if splitStr = "" then
ReverseString = strReverse(str)
exit function
end if
dim s, arr
s = ""
arr = split(str, splitStr)
for i = ubound(arr) to 0 step by -1
if i > 0 then
s = s & arr(i) & splitStr
else
s = s & arr(i)
end if
next
ReverseString = s
end function

response.Write(ReverseString("123,456,789", ","))
response.Write("<br />")
response.