开发者_StackOverflow中文版is it possible to get the last value of an string, that looks like this for example:
tm="1610612741|Bulls|Chicago|CHI"
and save it as a variable?
Something like that:
var tm = $(this).find('htm').attr('tm');
I only need the "CHI" string. I tried everything, but what i found doesnt work. I get the string and the var from an xml file. Also is it possible to parse the xml from a "live" version, like http://www.exampledomain.com/test.xml?
Appreciate your help!
Nicole
var tm = '1610612741|Bulls|Chicago|CHI';
var arr = tm.split('|');
var lastPart = arr[arr.length - 1];
alert(lastPart); // CHI
精彩评论