Created
April 27, 2022 16:43
-
-
Save thechriskent/801ee3afddee312304510c58b7b90403 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ClearCollect(binaryToInt,[]); | |
With({ | |
input: txtFromBinary.Text | |
}, | |
ForAll(Sequence(Len(input)), | |
With({ | |
binaryDigit: Right(Left(input,Len(input)-(Value-1)),1) //Grab the right most digit | |
}, | |
Collect(binaryToInt,{ | |
binaryDigit: binaryDigit, //Not necessary (debug) | |
value:If(binaryDigit = "1", Power(2,Value-1), 0), //Not necessary (debug) | |
runningTotal:If(binaryDigit = "1", Power(2,Value-1), 0) + If(Value=1, 0, Last(binaryToInt).runningTotal) | |
}) | |
) | |
) | |
); | |
Set(intResult,Last(binaryToInt).runningTotal); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment