Module:String Shifting

--		Lua 5.1 Copyright (C) 1994-2006 Lua.org, PUC-Rio

function string:split( inSplitPattern, outResults ) if not outResults then outResults = { } end local theStart = 1 local theSplitStart, theSplitEnd = string.find( self, inSplitPattern, theStart ) while theSplitStart do		table.insert( outResults, string.sub( self, theStart, theSplitStart-1 ) ) theStart = theSplitEnd + 1 theSplitStart, theSplitEnd = string.find( self, inSplitPattern, theStart ) end table.insert( outResults, string.sub( self, theStart ) ) return outResults end

function BytesToString(bytes) --Made by Philippe Lhoste local s = "" for i = 1, table.getn(bytes) do s = s .. string.char(bytes[i]) end return s end

function StringToBytes(string) local bytes = {} for i = 1, string.len(string) do		bytes[i] = string.byte(string,i) end return bytes end

function CheckChar(byte,checklist) local bytes = StringToBytes(checklist) local temp = false for i = 1, table.getn(bytes) do	if byte == bytes[i] then temp = true end end return temp end

function string:shift(input,offset) local bytes = StringToBytes(input) for i = 1,string.len(input) do	if not CheckChar(bytes[i]) then bytes[i] = bytes[i] + offset end end return BytesToString(bytes) end