CharacterRange.at constructor

CharacterRange.at(
  1. String string,
  2. int startIndex, [
  3. int? endIndex
])

Creates a new character iterator on string.

The iterator starts with a current range containing the substring from startIndex to endIndex of string. If startIndex is not a character boundary, the range starts at the beginning of the character that startIndex is pointing into. If endIndex is not a character boundary, the range end at then end of the character that endIndex is pointing into. If endIndex is not provided, it defaults to the same index as startIndex.

So, if no endIndex is provided, and startIndex is at a character boundary, the resulting iterator's current range is empty. Otherwise, the range will contain the characters of the substring from startIndex to endIndex, extended so that it contains entire characters of the original string.

Implementation

factory CharacterRange.at(String string, int startIndex, [int? endIndex]) =
    StringCharacterRange.at;