From: Ludo Date: 2002-11-28T01:27:51+09:00 Subject: Re: Strings and substrings --=-sa/3dfee0sGquEAS7dTI Content-Type: text/plain Content-Transfer-Encoding: 7bit On Wed, 2002-11-27 at 17:17, Daniel Carrera wrote: > Hello, > > str = "hello world" > str[0] # -> 104 it's the ASCII code of the caractere > > 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" ok, it's the substring > > Could someone explain to me what these do? And why I get: > > str[0,0] # -> "" and str[0,1] > > > Thanks a lot, > Daniel. -- Ludo ENIB/LI2 --=-sa/3dfee0sGquEAS7dTI Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit On Wed, 2002-11-27 at 17:17, Daniel Carrera wrote:
Hello,

str = "hello world"
str[0]  # -> 104
it's the ASCII code of the caractere

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"
ok, it's the substring

Could someone explain to me what these do?  And why I get:

str[0,0] # -> ""
and str[0,1]


Thanks a lot,
Daniel.
--
Ludo <coquelle@enib.fr>
ENIB/LI2
--=-sa/3dfee0sGquEAS7dTI--