Afficher un message
Vieux 16/09/2007, 20h19   #2
Ari Brown
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Newbie: what's Ruby idiom for word-by-word input?


On Sep 16, 2007, at 3:10 PM, Alex Shulgin wrote:

> Please show me the Ruby way!
>


http://ec1.images-amazon.com/images/I/41X2833B8TL.jpg

I believe that should be enough to show you the ruby way.

Maybe you could try this:

a = gets.chomp #=> "My name is Ari"
words = a.split(/ /) #=> ["My", "name", "is", "Ari"]

Tadah! I REALLY hope that's what you're looking for.

-------------------------------------------------------|
~ Ari
crap my sig won't fit


  Réponse avec citation
 
Page generated in 0,04087 seconds with 9 queries