teadrinker

Bynary to Decimal

Jul 3rd, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. bin := "0001 0100 1001 1011 0110"
  2.  
  3. MsgBox, % Bin2Dec(bin)
  4.  
  5. Bin2Dec(BinStr)  {
  6.    arr := StrSplit(BinStr,, " ")
  7.    max := arr.MaxIndex()
  8.    Loop % max
  9.       dec += arr[max - A_Index + 1] << (A_Index - 1)
  10.    Return dec
  11. }
Add Comment
Please, Sign In to add comment