Qbasicnews.com

Full Version: useless little func
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

Anonymous

i couldnt find anything that would convert a string binary into a numeric digit. maybe im just blind and shouldve known about such a function. nevertheless if it doesn't exist, i've made it in case someone ever needs it (prolly not anyone ever, lol)

heres a demo showing how to use it

Code:
Function VFB( bin_string$ ) As uInteger 'Value From Binary ( String )

  Dim speed_plx As uInteger = Len( bin_string$ )

  For p = 1 To speed_plx
    d += ( bin_string$ [ speed_plx - ( p )] - 48) * ( 2 ^ ( p - 1 ))

  Next


  Return d
  

End Function


? VFB( "110100100" )
? VFB( "111010110111100001101110001" )

Sleep