Return to Snippet

Revision: 15366
at July 2, 2009 13:27 by wak47


Initial Code
function Left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}

function Right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}

Initial URL

                                

Initial Description

                                

Initial Title
javascript left right functions

Initial Tags

                                

Initial Language
JavaScript