Hi everybody....
Here's a question for you. I think the answer is simple, but I'm not sure
how to go about it...what I want to do is to break down a string into
components. I already know about the LEFT, MID, and RIGHT properties, but I
don't believe they'll work in this case. Anyway:
I have an ASP page where I retrieve data off of a database
recordset...something like:
variable1=RecSet1(0)
the data stored in RecSet1(0) is something like AA,BB,CC,DD,EE or there may
even be spaces like AA, BB, CC, DD, EE
what I would like to do is to set up some new variables as pieces of the
string....so,
newvariable1 = whatever is to the left of the first comma
newvariable2 = whatever is between the first and second comma
etc...
I can trim out spaces later....I just need to know how to gather pieces in
front of, in between, or after a delimiter like a comma
Thanks
Tom 2 1706
Look at the Split function.
e.g. strThingymibob = Split(strData, ",") 'Split via comma
--
Regards
Steven Burn
Ur I.T. Mate Group www.it-mate.co.uk
Keeping it FREE!
Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
Thomas Brooks <br*****@bsi-vt.com> wrote in message
news:5L********************@news1.news.adelphia.ne t... Hi everybody....
Here's a question for you. I think the answer is simple, but I'm not sure how to go about it...what I want to do is to break down a string into components. I already know about the LEFT, MID, and RIGHT properties, but
I don't believe they'll work in this case. Anyway:
I have an ASP page where I retrieve data off of a database recordset...something like:
variable1=RecSet1(0)
the data stored in RecSet1(0) is something like AA,BB,CC,DD,EE or there
may even be spaces like AA, BB, CC, DD, EE
what I would like to do is to set up some new variables as pieces of the string....so,
newvariable1 = whatever is to the left of the first comma newvariable2 = whatever is between the first and second comma
etc...
I can trim out spaces later....I just need to know how to gather pieces in front of, in between, or after a delimiter like a comma
Thanks
Tom
How about using an array and splitting, like so:
<%
sString = "AA, BB, CC, DD, EE"
sString = Replace(sString, " ", "") ''optional. Might want to replacey ", "
with "," or do nothing at all
aParts = Split(sString, ",")
For i = 0 To UBound(aParts)
Response.Write "Part " & CStr(i + 1) & " is " & aParts(i) & "<br>"
Next
%>
Ray at work
"Thomas Brooks" <br*****@bsi-vt.com> wrote in message
news:5L********************@news1.news.adelphia.ne t... Hi everybody....
Here's a question for you. I think the answer is simple, but I'm not sure how to go about it...what I want to do is to break down a string into components. I already know about the LEFT, MID, and RIGHT properties, but
I don't believe they'll work in this case. Anyway:
I have an ASP page where I retrieve data off of a database recordset...something like:
variable1=RecSet1(0)
the data stored in RecSet1(0) is something like AA,BB,CC,DD,EE or there
may even be spaces like AA, BB, CC, DD, EE
what I would like to do is to set up some new variables as pieces of the string....so,
newvariable1 = whatever is to the left of the first comma newvariable2 = whatever is between the first and second comma
etc...
I can trim out spaces later....I just need to know how to gather pieces in front of, in between, or after a delimiter like a comma
Thanks
Tom
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: stevenkobes |
last post by:
If a word has a hyphen in it, IE will permit a line break at the
hyphen, but Firefox/Mozilla won't. Apparently the Firefox behavior is
standards-compliant, but it is not what I want. Is there a...
|
by: Jeffrey B. Holtz |
last post by:
I'm trying to get the Name of the USB device pluged in from the
RegisterDeviceNotification that I've used P/Invoke to marshal. I have
seen a similar posting on the VisualBasic newgroups but I do...
|
by: tony |
last post by:
If you have any PHP scripts which will not work in the current releases
due to breaks in backwards compatibility then take a look at
http://www.tonymarston.net/php-mysql/bc-is-everything.html and...
|
by: Michael Oswald |
last post by:
Hello,
I have a rather big application with many processes and have to add some
features. I want to put some classes of it into a test harness with
cppunit and need to break some dependencies on...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |