takeLast method
Returns the last count characters of the string.
Returns an empty string if count is negative, or the entire string
if count exceeds the string length.
Example:
'hello'.takeLast(2) // 'lo'
'hi'.takeLast(5) // 'hi'
'abc'.takeLast(0) // ''
Implementation
String takeLast(int count) {
if (count < 0) { return ''; }
if (count > length) { return this; }
return substring(length - count);
}