5

Is there a Ruby equivalent of Python's method for getting a substring that ends at the end of the string, like str[3:]? It's not convenient to have to put in the length of the string.

0

1 Answer 1

10

Pass a range with last element = -1

str[3..-1]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.