Run-length encoding: Difference between revisions

No edit summary
Line 2,864:
rl ++ // Same char, so increase counter
wend
// if rl == 1 then t = @"" else ... t = fn StringWithFormat( @"%d", rl ) // UncommentIgnore tocount ignoreof 1's
t = fn StringWithFormat( @"%d", rl ) // Counter as string
t = fn StringByAppendingString( t, ch ) // Add character
Line 2,874:
 
print fn encode( @"WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWBWWWWWWWWWWWWWW" )
print fn encode( fn decode( @"12W1B12W3B24W1B14W12WB12W3B24W1B14W" ) )
 
handleevents // Join Mac event loop
 
</syntaxhighlight>
Output:
<pre>
 
12W1B12W3B24W1B14W
12WB12W3B24WB14W
12W1B12W3B24W1B14W
12WB12W3B24WB14W
 
</pre>
 
60

edits