codePointAt method

int codePointAt(
  1. int index
)

Get the unicode point value from a specific index

Implementation

int codePointAt(int index) {
  int firstCodePoint = this.codeUnitAt(index);
  int secondCodePoint;
  if (firstCodePoint.isHighSurrogate() && this.length > index + 1) {
    secondCodePoint = this.codeUnitAt(index + 1);
    if (secondCodePoint.isLowSurrogate()) {
      return getAstralNumberFromSurrogatePair(
          firstCodePoint, secondCodePoint);
    }
  }
  return firstCodePoint;
}