Run-length encoding: Difference between revisions
Content added Content deleted
(add JavaScript) |
|||
Line 675: | Line 675: | ||
}</lang> |
}</lang> |
||
Here's an encoding method that uses a regular expression to grab the character runs ({{works with| |
Here's an encoding method that uses a regular expression to grab the character runs ({{works with|JavaScript|1.6}} for the <code>forEach</code> method) |
||
<lang javascript>function encode_re(input) { |
<lang javascript>function encode_re(input) { |
||
var encoding = []; |
var encoding = []; |