jquery 删除字符串最后一个字符的方法解析_jquery

WBOY
Release: 2016-05-16 17:00:49
Original
1162 people have browsed it

字符串: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('.'));

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!