I have some numbers string which is:
var _ids = 130,131,240;
i need to get some number from this string which is 131, i cant use .split() method because numbers between comas can be more, instead of this i know actual id which is number 130 (in this example), so i'am doing this:
var _id = 130;
var id = _ids.substring(_ids.lastIndexOf((_id + ',') + 1), _ids.lastIndexOf(','));
in result i have 130,136... What i'm doing wrong? Can anybody help?
Aucun commentaire:
Enregistrer un commentaire