convertLastCharacters method
Converts the last count
characters of this string with callback
. If
this is shorter than count
, this String is returned.
Implementation
String convertLastCharacters(String Function(String value) callback,
{int count = 1}) {
final iterator = characters.iteratorAtEnd;
if (iterator.moveBack(count)) {
return iterator.stringBefore +
callback(iterator.current + iterator.stringAfter);
}
return this;
}