headEqualsLength method

int headEqualsLength(
  1. String other
)

Returns the length of the head that is equals to the head of other.

Implementation

int headEqualsLength(String other) {
  var length = math.min(this.length, other.length);

  for (var i = 0; i < length; ++i) {
    var c1 = this[i];
    var c2 = other[i];

    if (c1 != c2) {
      return i;
    }
  }

  return length;
}