Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local concat, insert, unpack = table.concat, table.insert, table.unpack
- function permutecase(word)
- local ret = {}
- for i = #word, 1, -1 do
- if i == #word then
- ret[#ret+1] = word:sub(i,i):lower()
- ret[#ret+1] = word:sub(i,i):upper()
- else
- for j = 1, #ret do
- local case = ret[j]
- ret[#ret+1] = word:sub(i,i):upper() .. ret[j]
- ret[j] = word:sub(i,i):lower() .. ret[j]
- end
- end
- end
- return ret
- end
- for i, v in ipairs(permutecase("pass")) do
- print(i, v)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement