Decoding string

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sonnich

    Decoding string

    Hi all!

    Simple question, but I haven't used JS for a long time.

    I get a string, like "1,3" and need to read out the numbers 1 and 3. I
    can change the separator if needed, but all I want to is to send to
    numbers in a string, then decode them

    TIA
    Sonnich

  • zman

    #2
    Re: Decoding string


    Sonnich wrote:
    Hi all!
    >
    Simple question, but I haven't used JS for a long time.
    >
    I get a string, like "1,3" and need to read out the numbers 1 and 3. I
    can change the separator if needed, but all I want to is to send to
    numbers in a string, then decode them
    >
    TIA
    Sonnich
    Try this
    var str="1,2,3,4";
    var str_array=str.s plit(",");

    Array str_array contains the list of all the values.

    zafar

    ----------------------------------------------------



    Comment

    Working...