each_byte()
public
Passes each byte in str to the
given block.
"hello".each_byte {|c| print c, ' ' }
produces:
104 101 108 108 111
Show source
static VALUE
rb_str_each_byte(VALUE str)
{
long i;
RETURN_ENUMERATOR(str, 0, 0);
for (i=0; i<RSTRING_LEN(str); i++) {
rb_yield(INT2FIX(RSTRING_PTR(str)[i] & 0xff));
}
return str;
}