Add support for 0x prefix in hexadecimal

This commit is contained in:
Kevin Kandlbinder 2022-05-03 16:37:44 +02:00
parent 1a3c739061
commit ca0a6cf102
3 changed files with 3 additions and 5 deletions

View file

@ -26,7 +26,7 @@ const NumberBaseTool = () => {
num = parseInt(input.replaceAll(" ", ""), 10)
break
case "hex":
num = parseInt(input.replaceAll(" ", ""), 16)
num = parseInt(input.replaceAll(" ", "").replace(/^(0x)/,''), 16)
break
case "oct":
num = parseInt(input.replaceAll(" ", ""), 8)