Return to Snippet

Revision: 51311
at September 21, 2011 00:24 by athanassiadis


Initial Code
shortenString	: function( str, length ){
		
		var newStr = str;
        var words = str.split('', length + 1);
        if( words.length > length){
            words.pop();
            words.push('...');
            newStr =  words.join('');
       	}
	    return newStr;
	}

Initial URL

                                

Initial Description

                                

Initial Title
Shorten string in javascript

Initial Tags
javascript, js, textmate

Initial Language
Other