  const char *castToCharPtr() const {
    assert(isASCII() && "Cannot cast char16_t pointer to char pointer");
    if (!isHandle_) {
      return static_cast<const char *>(nonManagedStringPtr_) + startIndex_;
    }
    assert(isHandle_ && "StringView does not contain a valid string");
    return (*strPrim())->castToASCIIPointer() + startIndex_;
  }
  const char *castToCharPtr() const {
    assert(isASCII() && "Cannot cast char16_t pointer to char pointer");
    if (!isHandle_) {
      return static_cast<const char *>(nonManagedStringPtr_) + startIndex_;
    }
    assert(isHandle_ && "StringView does not contain a valid string");
    return (*strPrim())->castToASCIIPointer() + startIndex_;
  }