split question

Discussion in 'ASP General' started by peashoe, Jun 15, 2006.

  1. peashoe

    peashoe Guest

    Can anyone help me with a simple split problem. I've never done it
    before and I have no clue.

    I have value sSearch = Lastname Firstname

    I need to split it into two separate field:
    sLast = Lastname
    sFirst = Firstname

    I tried
    arrSearch = split(sSearch, " " )
    but how do I actually get the values?

    thanks in advance for your help
    Lisa
     
    peashoe, Jun 15, 2006
    #1
    1. Advertising

  2. for i = 0 to ubound(arrSearch)
    response.write i & " = " & arrSearch(i) & "<br>"
    next


    "peashoe" <> wrote in message
    news:...
    > Can anyone help me with a simple split problem. I've never done it
    > before and I have no clue.
    >
    > I have value sSearch = Lastname Firstname
    >
    > I need to split it into two separate field:
    > sLast = Lastname
    > sFirst = Firstname
    >
    > I tried
    > arrSearch = split(sSearch, " " )
    > but how do I actually get the values?
    >
    > thanks in advance for your help
    > Lisa
    >
     
    Aaron Bertrand [SQL Server MVP], Jun 15, 2006
    #2
    1. Advertising

  3. peashoe

    peashoe Guest

    thanks Aaron,
    but I don't need to display the data. I just need to grab it so I can
    do a sql select to get other data. Therefore, I need to actually have
    two values:

    sLast and sFirst...

    Make sense?
    ~L~
     
    peashoe, Jun 15, 2006
    #3
  4. "peashoe" <> wrote in message
    news:...
    > thanks Aaron,
    > but I don't need to display the data. I just need to grab it


    Okay, so don't response write, I was just showing you how to quickly see the
    data after the split.
     
    Aaron Bertrand [SQL Server MVP], Jun 15, 2006
    #4
  5. peashoe

    peashoe Guest

    the problem was I didn't know how to do it - but I found the answer on
    here anyway:

    arrSearch = split(sSearch, " ")

    this is what I didn't know how to do...
    sLast = arrSearch(0)
    sFirst = arrSearch(1)

    Thanks~!
     
    peashoe, Jun 15, 2006
    #5
    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. Replies:
    2
    Views:
    482
  2. Carlos Ribeiro
    Replies:
    11
    Views:
    720
    Alex Martelli
    Sep 17, 2004
  3. trans.  (T. Onoma)

    split on '' (and another for split -1)

    trans. (T. Onoma), Dec 27, 2004, in forum: Ruby
    Replies:
    10
    Views:
    229
    Florian Gross
    Dec 28, 2004
  4. Sam Kong
    Replies:
    5
    Views:
    263
    Rick DeNatale
    Aug 12, 2006
  5. Stanley Xu
    Replies:
    2
    Views:
    676
    Stanley Xu
    Mar 23, 2011
Loading...

Share This Page