web3.js web3.utils.isHex
web3.utils.isHex(hex)
δΈγγγγζεεγ16ι²ζ°ζεεγγ©γγγη’ΊθͺγγΎγγ
γγ©γ‘γΌγΏ
1. hex - String|HEX
16ι²ζ°ζεε
ζ»γε€
Boolean
γ΅γ³γγ«
code:example.js
web3.utils.isHex('0xc1912');
true
web3.utils.isHex(0xc1912);
true
web3.utils.isHex('c1912');
true
web3.utils.isHex(345);
true // this is tricky, as 345 can be a a HEX representation or a number, be careful when not having a 0x in front!
web3.utils.isHex('0xZ1912');
false
web3.utils.isHex('Hello');
false
εθ