November 25, 2020, 06:08:50 AM

Author Topic: [bb] Binary string to integer by Snarkbait [ 1+ years ago ]  (Read 644 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
Title : Binary string to integer
Author : Snarkbait
Posted : 1+ years ago

Description : Converts a string created with bin$ back to an integer.

Code :
Code: BlitzBasic
  1. Function bin2int(this$)
  2.         thisint = 0
  3.         blen = Len(this$)
  4.         For a = 1 To blen
  5.                 ibit = Int(Mid$(this$,a,1))
  6.                 If ibit thisint = thisint + (ibit * (2^(blen - a)))
  7.         Next
  8.         Return thisint
  9. End Function


Comments : none...

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal