Advertisement
Rochet2

encode character

Feb 12th, 2017
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.61 KB | None | 0 0
  1. Removing a character from string
  2. 1. https://github.com/Rochet2/luaencoder/blob/master/Encoder.lua (possibly not an universal solution)
  3. 2. To replace 'c' from a string change all 'a' to 'ab' and then all 'c' to 'ax', at worst doubles the text amount. To reverse change all 'ax' to 'c' and 'ab' to 'a'
  4. 3. To replace 'c' from a string go through the string and remove all 'c' and record their positions then add the positions to the start of the string, at worst adds text linear to the amount of c letters to the start in the form of the positions. To reverse take the positions and add the 'c' character to each position.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement