Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: Split-up

  1. #1
    Regular Coder
    Join Date
    Nov 2002
    Location
    Loughborough (UK)
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Split-up

    Hello,

    I've got a feeling this may actually be a JS problem, but there may also be ways to do it in ASP that I would understand better. I have a value in my db that is along the format of 1_1, or 2_4 etc. I need to pull that out in one of my pages, but then source some text values against the first number from one table, and then another text value for the second value from another table. Obviously I know how to use a WHERE statement ot get the data I want, but how do I split the *_* value up into two separate parts? Hope you can help.

    Chris

  • #2
    New Coder
    Join Date
    Jan 2003
    Location
    Peterborough, UK
    Posts
    39
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Using the split function will seperate the string into an array, thus:

    ArrayName = Split("1_1","_") will split the string at each instance of _.

    Then you can use:

    ArrayName(0) to retrieve the first value
    ArrayName(1) to retrieve the 2nd

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    What he said ^^.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)


  •  

    Posting Permissions

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