# Comparison and Equality

> StringZilla for Python

### Equality and Offsets

- `sz.equal(first, second)` — module-level fast byte-wise equality, returning `bool`.
- `offset_within(larger)` — returns the byte offset of this `String` view inside a larger `String` it was sliced from, or `-1` if it is not a sub-view.

```python
import stringzilla as sz

assert sz.equal("abc", "abc")
big = sz.String("hello world")
assert big[6:].offset_within(big) == 6
```

`import stringzilla`

## equal

Check if two strings are equal.

```python
def equal(
    first: _StringLike,
    second: _StringLike,
    /,
    *,
    capabilities: Capability | None = None,
) -> bool
```

This function can be called as a method on a String object or as a standalone function.
Args:
first (String or str or bytes): The first string object.
second (String or str or bytes): The second string object.
capabilities (Capability, optional): Capabilities to run, defaulting to the CPU's enabled ones.
Returns:
bool: True if the strings are equal, False otherwise.
Note:
Comparison is byte-level: a `str` and a `bytes` with identical bytes compare equal.
Raises:
TypeError: If the argument is not string-like or incorrect number of arguments is provided.

Examples: ```
>>> sz.equal('abc', 'abc')
True
```

