Logan Capaldo
8/13/2006 6:44:00 PM
On Aug 12, 2006, at 4:33 PM, snacktime wrote:
> Or to be more exact, how would I do the following in ruby?
>
> while ($string =~ /\0/g) {
> $new_string .= sprintf '\%o', (pos $string) - 1;
> }
>
if perldoc -f pos is describing what pos does in this case,
new_string = ""
while pos = string =~ /\0/g
new_string << "%o" % (pos - 1)
end