From 627277b8868c8f2a6adc5ead9c7ac5834d88fb2e Mon Sep 17 00:00:00 2001 From: Eldon Williams Date: Tue, 6 Sep 2022 14:14:07 -0500 Subject: [PATCH] Add support for 0b notation Currently, if a binary string formatted with 0b is inputted, it will resolve to zero since it only cares about the first numerical character in the line. This change will detect if 0b is at the head and if so, will cut it off. --- Boop/Boop/scripts/BinaryToDecimal.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Boop/Boop/scripts/BinaryToDecimal.js b/Boop/Boop/scripts/BinaryToDecimal.js index c962d276..1afa01a9 100644 --- a/Boop/Boop/scripts/BinaryToDecimal.js +++ b/Boop/Boop/scripts/BinaryToDecimal.js @@ -16,6 +16,7 @@ function main(state) { for (const index in lines) { var text = lines[index].trim(); + if (text.startsWith("0b")) text = text.split("0b").pop(); var decimal = parseInt(text, 2); if (isNaN(decimal)) {