What's the Ruby equivalent of Python's output[:-1]?
- by Thierry Lam
In Python, if I want to get the first n characters of a string minus the last character, I do:
output = 'stackoverflow'
print output[:-1]
I can do the above in Ruby with:
output = 'stackoverflow'
output.reverse[1..output.length]
Is there another way to perform this action in Ruby?