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