string array

Discussion in 'Ruby' started by Oziris Moreira, Mar 26, 2010.

  1. I would like to know how I can put a word into an array character by
    character, for example the user type the word "hello" and the array
    would be ["h","e","l","l","o"], I only know how to this with gets but I
    don't want to press enter after every character.

    thanks in advance
    --
    Posted via http://www.ruby-forum.com/.
     
    Oziris Moreira, Mar 26, 2010
    #1
    1. Advertising

  2. Oziris Moreira wrote:
    > I would like to know how I can put a word into an array character by
    > character, for example the user type the word "hello" and the array
    > would be ["h","e","l","l","o"], I only know how to this with gets but I
    > don't want to press enter after every character.
    >
    > thanks in advance


    s = 'hello'
    s_array = s.split('')

    --
    Posted via http://www.ruby-forum.com/.
     
    Giampiero Zanchi, Mar 26, 2010
    #2
    1. Advertising

  3. Giampiero Zanchi wrote:
    > Oziris Moreira wrote:
    >> I would like to know how I can put a word into an array character by
    >> character, for example the user type the word "hello" and the array
    >> would be ["h","e","l","l","o"], I only know how to this with gets but I
    >> don't want to press enter after every character.
    >>
    >> thanks in advance

    >
    > s = 'hello'
    > s_array = s.split('')


    thank you very much !
    --
    Posted via http://www.ruby-forum.com/.
     
    Oziris Moreira, Mar 26, 2010
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?UmFqZXNoIHNvbmk=?=

    'System.String[]' from its string representation 'String[] Array'

    =?Utf-8?B?UmFqZXNoIHNvbmk=?=, May 4, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    1,820
    =?Utf-8?B?UmFqZXNoIHNvbmk=?=
    May 4, 2006
  2. Replies:
    7
    Views:
    658
  3. Mara Guida

    const and array of array (of array ...)

    Mara Guida, Sep 2, 2009, in forum: C Programming
    Replies:
    3
    Views:
    524
    David RF
    Sep 3, 2009
  4. Tom
    Replies:
    3
    Views:
    236
    salsablr
    Dec 20, 2004
  5. Tuan  Bui
    Replies:
    14
    Views:
    532
    it_says_BALLS_on_your forehead
    Jul 29, 2005
Loading...

Share This Page