Find the answer to your Linux question:
Results 1 to 4 of 4
Hello, I need to split string into characters and put then in the right order into an array. how to do that?...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Aug 2011
    Posts
    2

    splitting string


    Hello,

    I need to split string into characters and put then in the right order into an array.

    how to do that?

  2. #2
    Just Joined!
    Join Date
    Sep 2010
    Posts
    8
    I'm sorry but your question is not very specific. What is "the right order" and more importantly, what language do you want this in? Or do I have a choice?

  3. #3
    Just Joined!
    Join Date
    Aug 2011
    Posts
    2
    sorry.

    here is the string:

    "book"

    here is the array

    arr[0]=b
    arr[1]=o
    arr[2]=o
    arr[3]=k

    using only bash

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Guru Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,252
    This sounds a lot like a homework problem. They are not allowed on this forum.

    You can try these links to get some ideas:

    Arrays
    Manipulating Strings

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •