Home  >  Article  >  Web Front-end  >  jquery method to delete the last character of a string parsing_jquery

jquery method to delete the last character of a string parsing_jquery

WBOY
WBOYOriginal
2016-05-16 17:00:491188browse

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('.'));

Statement:
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