Skip to main content

Function: stripHexPrefix()

GalaChain core SDK 1.0.0-rc.8


GalaChain core SDK 1.0.0-rc.8 / bridge / stripHexPrefix

Function: stripHexPrefix()

stripHexPrefix(hex): string

Defined in: packages/gala-core-sdk/dist/bridge.d.ts:2582

Removes "0x" prefix from Ethereum address hex values

Consolidates 13 scattered instances of manual 0x removal patterns:

  • .replace('0x', '')
  • .slice(2)
  • .substring(2) with startsWith check

Parameters​

hex​

string

Hex value potentially with 0x prefix

Returns​

string

Hex value without 0x prefix

Example​

stripHexPrefix('0x123abc') // '123abc'
stripHexPrefix('123abc') // '123abc'