javascript - Remove part of a string before a certain position -
i have string want cut , remove first part.
something 'abcded-cddndcasds--xyz--jkajsjasasasasas'
i want remove before position x.
so far can find position of x, can't find quick function remove before.
thanks
try this
$(function(){ var str = 'abcded-cddndcasds--xyz--jkajsjasasasasas'; var indexofx = str.indexof("x"); alert(str.substring(indexofx,str.length)); });
Comments
Post a Comment