var str="1,2,3,4,5,"; var newstr=str.substring(0,str.length-1); alert(newstr); 转载于:https://www.cnblogs.com/yjhua/p/5092377.html