Scripting a text to binary digits converter

Bryan McCormick bryan at deepfoo.com
Mon Jan 2 15:23:16 EST 2012


JB, Guglielmo

This appears to work for my purposes and is pretty speedy. See anything 
that might break?

---------------------------------------

function convertTextToBinary varText
    repeat with n = 1 to the number of chars of varText
       put chartonum(char n of varText) into theNum
       if theNum >=64 and theNum <= 127 then
          put "0"&baseConvert(theNum,10,2) after tConverted
       else if theNum <="64" then
          put "00"&baseConvert(theNum,10,2) after tConverted
       else
          put baseConvert(theNum,10,2) after tConverted
       end if
    end repeat
    return tConverted
end convertTextToBinary




More information about the use-livecode mailing list