Solved

Select to right of &

Posted on 2006-11-14
4
591 Views
Last Modified: 2008-03-04
HI folks.

I've got a field in my db that as too many values in it, and I need to split it up.  The character inserted that indicates the split is "&".

For example...

530903356&05/2007&999&&Felix+Nemitz

The first set of numbers is no set length.
The second set should always be the same
The third set is 3 characters
The final set is a name.

I want to split them like this

Num = 1st set
date = 2nd set
secret = 3rd set
Name = Last set

How can I do this with VBscript???

Thanks
0
Comment
Question by:ClassyLinks
  • 3
4 Comments
 
LVL 31

Accepted Solution

by:
alorentz earned 500 total points
ID: 17939308
Then split it with split function.

<%
val = "530903356&05/2007&999&&Felix+Nemitz"
arr = split(val, "&")
for i = 0 to ubound(arr)
  response.write arr(i) & "<br>"
next
%>
0
 
LVL 31

Expert Comment

by:alorentz
ID: 17939313
0
 
LVL 2

Expert Comment

by:_DanElliott
ID: 17939327
You can use the Split function to get the values into an array:

Dim values
values = Split(String_to_Split,"&")

Now values is an array and:
values(0) = the first part (num)
values(1) = the second part (date)
values(2) = the third part (secret)
values(3) = the fourth part (name)

0
 
LVL 31

Expert Comment

by:alorentz
ID: 17939389
>>DanElliott

When reposting, whether by mistake or not, it's good to acknowledge you provided the same answer as already suggested.  thanks
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
This video discusses moving either the default database or any database to a new volume.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now