Skip to main content

bytes32ToString

This function converts a bytes32 value, given as a hexadecimal string, into a readable string representation.

function bytes32ToString(_hex: string): string

Usage

MyComponent.tsx
import { lnr } from '@linagee/lnr-ethers-react';

const MyComponent = () => {
const hexString = `0x307868616c000000000000000000000000000000000000000000000000000000`;

return (
<div>
<h1>{lnr.utils.bytes32ToString(hexString)}</h1>
</div>
);
};

export default MyComponent;

The above code will render the following:

0xhal

Parameters

  • _hex (string): A hexadecimal string representation of a bytes32 value.

Returns

  • (string): The string representation of the bytes32 value.