> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qu.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# isHexString

```ts theme={null}
function isHexString(value, length?): value is `0x${string}`
```

Returns true if `value` is a valid HexString | **HexString**.

If `length` is `true` or a number, it also checks that `value` is a valid DataHexString | **DataHexString** of
`length` (if a number) bytes of data (e.g. `0x1234` is 2 bytes).

## Parameters

| Parameter | Type                  | Description                      |
| :-------- | :-------------------- | :------------------------------- |
| `value`   | `any`                 | The value to check.              |
| `length`? | `number` \| `boolean` | The expected length of the data. |

## Returns

value is \`0x\$\{string}\`

True if the value is a valid HexString | **HexString**.

## Source

[utils/data.ts:98](https://github.com/dominant-strategies/quais.js/blob/c1c12d43f9d34c6baad2b0542bd6d0acd6fefcbf/src/utils/data.ts#L98)
