I have a string in the variable text. If I do text[0 .. 29] I get the first 30 characters. What if I want the last part of string which I don’t know the length?
I have a string in the variable text . If I do text[0 ..
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use
test[-30..-1]Doc: http://www.ruby-doc.org/core-1.9.3/String.html#method-i-5B-5D