asp 去除最后一个逗号为空字符串的代码

asp中怎么替换最后一个逗号为空字符串
举例 aaa,bbb,ccc,eee, 这个字符串

怎么让最后一个逗号变没,其他的不变啊
问题补充:举例 aaa,bbb,ccc,eee, 这个字符串

怎么让最后一个逗号变没,其他的不变啊
如果是aaa,bbb,ccc,eee则不做修改

<% 
str="aaa,bbb,ccc,eee," 
if right(str,1)="," then 
str=left(str,len(str)-1) 
end if 
%> 

asp Right 函数 可从字符串右边返回指定数目的字符。

提示:要确定 string 参数中的字符数目,使用 Len 函数

提示:还可以参考下Left函数

语法
Right(string,length)

参数 描述
string
必选项。字符串表达式,其最右边的字符被返回。
length
必选项。数值表达式,指明要返回的字符数目。如果为 0,返回零长度字符串;如果此数大于或等于 string 参数中的所有字符数目,则返回整个字符串。

实例 1

dim txttxt="This is a beautiful day!" 
response.write(Right(txt,11)) 
输出:utiful day! 

实例 2

dim txttxt="This is a beautiful day!" 
response.write(Right(txt,100)) 
输出:This is a beautiful day! 

 实例 3

dim txt,xtxt="This is a beautiful day!"x=Len(txt) 
response.write(Right(txt,x)) 
输出:This is a beautiful day!