Run-length encoding: Difference between revisions

Content deleted Content added
added PowerShell
Tikkanz (talk | contribs)
→‎{{header|J}}: simplify and speed up rle
Line 543: Line 543:
NB. Run-length encode and decode...
NB. Run-length encode and decode...
rle=. >@:(,&.>/)@:((":@:# , {.)&.>)@:((1 , 2 ~:&>/\ ]) <;.1 ])
rle=: ([: ; (":@# , {.)&.>)@((1 , }. ~: }:) <;.1 ])
rle 'WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWBWWWWWWWWWWWWWW'
rle 'WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWBWWWWWWWWWWWWWW'
12W1B12W3B24W1B14W
12W1B12W3B24W1B14W
Line 551: Line 551:
WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWBWWWWWWWWWWWWWW
WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWBWWWWWWWWWWWWWW
</lang>
</lang>

=={{header|Java}}==
=={{header|Java}}==
<lang java>import java.util.regex.Matcher;
<lang java>import java.util.regex.Matcher;