帮小弟改点代码从.net 改成asp 很简单的几句 50分

来源:百度知道 编辑:UC知道 时间:2024/09/23 15:27:27
private string addres(string str, int n)
{
if (str.Trim().Length > 0)
{
if (str.IndexOf("地区") >= 0 || str.IndexOf("市") >= 0 || str.IndexOf("州") >= 0)
{
str = str.Replace("地区", "地区$");
str = str.Replace("市", "市$");
str = str.Replace("州", "州$") + "$";

string temp = str.Substring(0, str.IndexOf("$"));
str = Strleft(temp, 20);
return str;
}
}
return "";
}
这个事.net 代码 帮忙改成asp 的 谢谢

'参数n没用到??
function addres(str, n)
if len(Trim(str)) > 0 then
if instr(str,"地区") > 0 or instr(str,"市") > 0 or instr(str,"州") > 0 then
str = Replace(str, "地区", "地区$")
str = Replace(str, "市", "市$")
str = Replace(str, "州", "州$") & "$"

temp = mid(str, 1, instr(str,"$")) 'temp = left(str, instr(str,"$"))
str = left(temp, 20); '假设Strleft是个截取字符串左边的函数
addres = str
exit function
end if
end if
addres = ""
end function

Strleft ? 这个是什么?

未经调试,自己纠错。

function addres(str,n)
str=trim(str)

if len(str)>0
if instr(str,"地区")>0 or instr(str,"市")>0 or instr(str,"州")>0 then
str=replace(str,"地区","地区$")
str=replace(str,"市","市$&quo