convertLastCharacters method

String convertLastCharacters(
  1. String callback(
    1. String value
    ), {
  2. int count = 1,
})

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;
}