From c60c96e32a8ab017c93d450d710a650c41fc76a7 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Wed, 16 Jun 2021 09:01:14 +0200 Subject: global-functions: $HexToNum: properly handle capital characters --- global-functions | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/global-functions b/global-functions index d4aa574..2cfe595 100644 --- a/global-functions +++ b/global-functions @@ -429,12 +429,12 @@ # convert from hex (string) to num :set HexToNum do={ :local Input [ :tostr $1 ]; - :local Hex "0123456789abcdef"; + :local Hex "0123456789abcdef0123456789ABCDEF"; :local Multi 1; :local Return 0; :for I from=([ :len $Input ] - 1) to=0 do={ - :set Return ($Return + ([ :find $Hex [ :pick $Input $I ] ] * $Multi)); + :set Return ($Return + (([ :find $Hex [ :pick $Input $I ] ] % 16) * $Multi)); :set Multi ($Multi * 16); } -- cgit v1.2.3-70-g09d2