Вот удобная функция усечения, которую я использую.
// Examples
truncate('abcdefghijklmnopqrstuvwxyz'); // returns 'abcdefghijklmnopqrst...'
truncate('hello there', 15); // returns 'hello there'
truncate('hello there', 5, '...read more...'); // returns 'hello...read more...'
// Truncating method
function truncate(string, length, end)
{
if (typeof length == 'undefined')
{
length = 20;
}
if (typeof end == 'undefined')
{
end = '...';
}
if (string == null)
{
return '';
}
return string.substring(0, length-1)+(string.length > length ? end : '');
}