Advertisement
31ph4n70m

reverse_string.lua

Nov 19th, 2019
566
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.25 KB | None | 0 0
  1. -- Lua solution to codeabbey challenge 30
  2. function utf8.reverse(s)
  3.     local r = ""
  4.     for p,c in utf8.codes(s) do
  5.         r = utf8.char(c)..r
  6.     end
  7.     return r
  8. end
  9.  
  10. inp = "on fare supper off shelf jeopardy about cactus"
  11. opt = utf8.reverse(inp)
  12. print(opt)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement