Monday, May 19, 2014

jquery split string and get last item

Problem:
String "/Content/Upload/2521Shehb/erp.xlsx"
 Need "erp.xlsx"

Solution:
 str = "/Content/Upload/2521Shehb/erp.xlsx";
 arr = str.split('/');
 strFine = arr[arr.length - 1];
 alert(strFine);

No comments:

Post a Comment