convertTextToBinary
JB
sundown at pacifier.com
Mon Sep 29 14:05:51 EDT 2014
This will do it.
function convertTextToBinary varText --THE FASTEST
repeat with n = 1 to the number of chars of varText
add 1 to x
put chartonum(char n of varText) into theNum
put baseConvert(theNum,10,2) into tBaseConverted
put char -8 to -1 of ("00000000" & tBaseConverted ) into tBaseConverted
if x = 8 then
put return after tConverted
put 1 into x
end if
put tBaseConverted after tConverted
end repeat
return tConverted
end convertTextToBinary
John Balgenorth
On Sep 29, 2014, at 10:35 AM, JB <sundown at pacifier.com> wrote:
> A few years ago there was a discussion about
> converting ascii to binary code and ff I am
> correct the code below was the final version.
>
> function convertTextToBinary varText --THE FASTEST
> repeat with n = 1 to the number of chars of varText
> put chartonum(char n of varText) into theNum
> put baseConvert(theNum,10,2) into tBaseConverted
> put char -8 to -1 of ("00000000" & tBaseConverted ) into tBaseConverted
> put tBaseConverted after tConverted
> end repeat
> return tConverted
> end convertTextToBinary
>
>
> Does anyone know how to change this code so it
> will put the converted text on more than one line?
> It appears there is a limit to how many characters
> you can put on one line in a field so if you have a
> large text file to read and convert when it is put in
> a field you end up losing part of it.
>
> John Balgenorth
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
More information about the use-livecode
mailing list