String.prototype.strLeftBack=function(seperator)    {
    var pos=this.lastIndexOf(seperator);
    var result=this.substring(0,pos)
    return result;
}
alert("xkrky".strLeftBack('k')); //will alert 'xkr'
function strLeftBack(stringValue,seperator)    {
    var pos=stringValue.lastIndexOf(seperator);
    var result=stringValue.substring(0,pos)
    return result;
} 
alert(strLeftBack("xkrky",'k')); //will alert 'xkr'
 
 
No comments:
Post a Comment