News:

PlayBASIC2DLL V0.99 Revision I Commercial Edition released! - Convert PlayBASIC programs to super fast Machine Code. 

Main Menu

Convert list pf binary values back to a string

Started by kevin, March 14, 2022, 08:41:51 PM

Previous topic - Next topic

kevin

   This example takes a secret message encoded as a list of 8bit binary values and outputs a string.


   functions used:  Val()   SplitToArray() and  Chr$()

PlayBASIC Code: [Select]
   Message$ = "01010000 01101111 01110011 01110100 01101001 01101110 01100111 00100000 01101001 01101110 00100000 01100010 01101001 01101110 01100001 01110010 01111001 00101100 00100000 01101001 01110011 00100000 01101001 01101110 01110100 01101001 01101101 01101001 01100100 01100001 01110100 01101001 01101110 01100111 00100000 01100110 01101111 01110010 00100000 01100010 01100101 01100111 01101001 01101110 01101110 01100101 01110010 01110011 00101110 00100000"

Dim Values$(100)
Count=Splittoarray(Message$," ",Values$())
for lp=0 to Count-1
ChrValue = val("%"+Values$(lp))
s$+=chr$(ChrValue )
next

print "Secret Message:"+s$

Sync
waitkey





      Tags:   Learn TO Code, How to Program,