The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Newsgroups: comp.lang.ruby
From: James Edward Gray II <ja...@grayproductions.net>
Date: Sun, 12 Feb 2006 09:12:35 +0900
Local: Sat, Feb 11 2006 7:12 pm
Subject: Re: Getting last character from a string
On Feb 11, 2006, at 6:07 PM, draco draco wrote:
> Hello Hello. > I'm new to Ruby. Welcome then. > I've a simple question. Strings can take a negative index, which count backwards from the end > Is there a more readable way to get last character from string than > this > one? : > x = "text" of the String, and an length of how many characters you want (one in this example). Using that: "test"[-1, 1] # => "t" Hope that helps. James Edward Gray II You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||