Truncates the string to the given length.
length
String truncToLength(int length) { return (this.length > length ? substring(0, length).trim() : this); }