Thanks, this was helpful. I change it a bit to accommodate what I needed.
UI.registerHelper('shortIt', function(stringToShorten, maxCharsAmount){
if(stringToShorten.length <= maxCharsAmount){
return stringToShorten;
}
return stringToShorten.substring(0, maxCharsAmount);
});
I did this so that the returned string is shortened only if it is longer than what was put in and if it isn't I only needed the whole string returned.
Thanks
Achievements
10
Karma
0
Total ProTip Views
Charity
Fork and commit to someone's open source project in need
Thanks, this was helpful. I change it a bit to accommodate what I needed.
UI.registerHelper('shortIt', function(stringToShorten, maxCharsAmount){ if(stringToShorten.length <= maxCharsAmount){ return stringToShorten; } return stringToShorten.substring(0, maxCharsAmount); });
I did this so that the returned string is shortened only if it is longer than what was put in and if it isn't I only needed the whole string returned.
Thanks