Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
|
|
@ -0,0 +1,43 @@
|
|||
function rlEncode str
|
||||
local charCount
|
||||
put 1 into charCount
|
||||
repeat with i = 1 to the length of str
|
||||
if char i of str = char (i + 1) of str then
|
||||
add 1 to charCount
|
||||
else
|
||||
put char i of str & charCount after rle
|
||||
put 1 into charCount
|
||||
end if
|
||||
end repeat
|
||||
return rle
|
||||
end rlEncode
|
||||
|
||||
function rlDecode str
|
||||
repeat with i = 1 to the length of str
|
||||
if char i of str is not a number then
|
||||
put char i of str into curChar
|
||||
put 0 into curNum
|
||||
else
|
||||
repeat with n = i to len(str)
|
||||
if isnumber(char n of str) then
|
||||
put char n of str after curNum
|
||||
else
|
||||
put repeatString(curChar,curNum) after rldec
|
||||
put n - 1 into i
|
||||
exit repeat
|
||||
end if
|
||||
end repeat
|
||||
end if
|
||||
if i = len(str) then --dump last char
|
||||
put repeatString(curChar,curNum) after rldec
|
||||
end if
|
||||
end repeat
|
||||
return rldec
|
||||
end rlDecode
|
||||
|
||||
function repeatString str,rep
|
||||
repeat rep times
|
||||
put str after repStr
|
||||
end repeat
|
||||
return repStr
|
||||
end repeatString
|
||||
Loading…
Add table
Add a link
Reference in a new issue