Solved

Select to right of &

Posted on 2006-11-14
4
616 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

840 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