...

View Full Version : Split-up



christrinder
02-28-2003, 10:00 AM
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

raven
02-28-2003, 11:26 AM
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

whammy
03-01-2003, 01:46 AM
What he said ^^. ;)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum