Run-length encoding: Difference between revisions
m
→{{header|Sidef}}: modified the code to work with the latest version of Sidef
m (→{{header|Sidef}}: modified the code to work with the latest version of Sidef) |
|||
Line 3,513:
func decode(str) {
str.gsub(/(\d+)(.)/, {|a,b| b * a.to_i });
}
{{out}}
<pre>12W1B12W3B24W1B14W</pre>
Line 3,525:
var chars = str.chars;
var r = '';
r += (chars[2*i + 1] *
}
return r;
}
{{out}}
<pre>"\fW\1B\fW\3B\30W\1B\16W"</pre>
|