Stefano Crocco
8/21/2008 8:51:00 AM
On Thursday 21 August 2008, Newb Newb wrote:
> I have string.
> In that i need to display the first element from String means Which
> Function Should I use?
> I Am Unable To Figure Out..
Try String#[] or String#slice, but since they return a number (the code of the
first character) if you only specify an index, you'll need to pass the index
and a length of 1, like this:
"test string"[0,1]
=> "t"
For more information, see the documentation for the String#slice method (ri
String#slice).
Stefano