Home > Web Front-end > JS Tutorial > body text

jquery method to delete the last character of a string parsing_jquery

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

String: var s = "1,2,3,4,5,"

Goal: Delete the last ","

Method:
s=s.substring(0,s.Length-1);

String: var s2 = "img/upload/123.jpg"

Goal: Get the file name (excluding suffix)

Method:
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template