Home >Web Front-end >JS Tutorial >jquery method to delete the last character of a string parsing_jquery
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('.'));