To get the last n characters from a string, I assumed you could use
n
ending = string[-n..-1]
but if the string is less than
ending = string.reverse[0...n].reverse