字符串:var s = "1,2,3,4,5,"
目标:删除最后一个 ","
方法:
s=s.substring(0,s.Length-1);
字符串:var s2 = "img/upload/123.jpg"
目标:获取文件名(不包含后缀名)
方法:
s2=s2.substring(s2.lastIndexOf('/')+1, s2.lastIndexOf('.'));
时间: 2024-10-31 01:47:03
字符串:var s = "1,2,3,4,5,"
目标:删除最后一个 ","
方法:
s=s.substring(0,s.Length-1);
字符串:var s2 = "img/upload/123.jpg"
目标:获取文件名(不包含后缀名)
方法:
s2=s2.substring(s2.lastIndexOf('/')+1, s2.lastIndexOf('.'));