binary_to_text
string binary_to_text ( string binary )
This converts given binary into text. Note that the given binary must
be a string that has characters divisable by 8. Any character that over an
amount divisable by 8 is ignored.
Example 1. Using binary_to_text
{
show_message(binary_to_text(
"010010010111010000100000011101110110111101110010011010110111001100100001"
));
}
Shows message:
It works!
{
var retval, pos, ascii;
retval = "";
pos = 1;
repeat (string_length(argument0) div 8)
{
ascii = 0;
repeat (8)
{
ascii = (ascii << 1) | (string_char_at(argument0, pos) == "1");
pos += 1;
}
retval += chr(ascii);
}
return retval;
}