Get values from string using jquery or javascript -
i have string this:-
var src=url("http://localhost:200/assets/images/eyecatcher/6/black6.png)"
and want image name i.e black6.png
, folder name 6
. know there substr
function can use file name , folder name dynamic orange12.png
, 12
etc.
how can these values? please me.
thanks
if base url same do
var url = "http://localhost:200/assets/images/eyecatcher/6/black6.png"; var bits = url.replace("http://localhost:200/assets/images/eyecatcher/", "").split("/"); var folder = bits[0], // 6 file = bits[1]; // black6.png
Comments
Post a Comment