Example #1
0
    public bool EndsWith(Utf8String other)
    {
        var otherLength = other.Length;
        var offset      = Length - otherLength;

        return(offset >= 0 && ByteStringFunctions.Equals(other.Path, otherLength, Path + offset, otherLength));
    }
Example #2
0
    public bool Equals(Utf8String?other)
    {
        if (ReferenceEquals(null, other))
        {
            return(false);
        }

        if (ReferenceEquals(this, other))
        {
            return(true);
        }

        return(_crc32 == other._crc32 && ByteStringFunctions.Equals(_path, Length, other._path, other.Length));
    }
Example #3
0
    public bool EqualsCi(Utf8String?other)
    {
        if (ReferenceEquals(null, other))
        {
            return(false);
        }

        if (ReferenceEquals(this, other))
        {
            return(true);
        }

        if ((IsAsciiLowerInternal ?? false) && (other.IsAsciiLowerInternal ?? false))
        {
            return(_crc32 == other._crc32 && ByteStringFunctions.Equals(_path, Length, other._path, other.Length));
        }

        return(ByteStringFunctions.AsciiCaselessEquals(_path, Length, other._path, other.Length));
    }
Example #4
0
    public bool StartsWith(Utf8String other)
    {
        var otherLength = other.Length;

        return(otherLength <= Length && ByteStringFunctions.Equals(other.Path, otherLength, Path, otherLength));
    }