function trim(str)
{
if(!str || typeof str != 'string')
return null;
return str.replace(/^[\s]+/,'').replace(/[\s]+$/,'').replace(/[\s]{2,}/,' ');
}
{
if(!str || typeof str != 'string')
return null;
return str.replace(/^[\s]+/,'').replace(/[\s]+$/,'').replace(/[\s]{2,}/,' ');
}
Comments