On Thu, Nov 28, 2002 at 01:17:15AM +0900, Daniel Carrera wrote:
> Hello,
> 
> str = "hello world"
> str[0]  # -> 104
> 
> What does 'str[0]' do?  Why does it print 104 instead of "h"?
> 
> I realize that these work:
> 
> str[0..0] # -> "h"
> str[0,1]  # -> "h"
> 
> Could someone explain to me what these do?  And why I get:

http://www.glue.umd.edu/~billtj/ruby.html#characters
 
> str[0,0] # -> ""

substring starting at index 0, length 0 => empty string

 
-- 
 _           _                             
| |__   __ _| |_ ___ _ __ ___   __ _ _ __  
| '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ 
| |_) | (_| | |_\__ \ | | | | | (_| | | | |
|_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_|
	Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com

C is quirky, flawed, and an enormous success
	-- Dennis M. Ritchie