URGENT: Parsing a String

Hi All

I have a string formatted as follows:

2005443,"1/20050602104455/636","13/04/2006 14:49:02 ACT DWE : Printed:s80 - No Property"

I need to break this string down .... I use the split function and would not ordinarily have trouble, but because I need to break it down a little further I am getting lost a little

Using the above string as an example .... I need to break the string down into the following variables

FileNum = 2005443
ClientRef = 1/20050602104455/636
DateTime = 13/04/2006 14:49:02
Act = ACT
Author = DWE
Note = Printed:s80 - No Property

All of the strings are typed as strings except the datetime variable which is a date.

Notice the part of the string which commences with the DateTime variable is what I am having trouble with, as in my example string it is all one field.

Commented coded answers are appreciated



Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Use the split function to split the main string with a ","
Then use the Split function again to split the last string with a " ".
dwe0608Author Commented:
I gave that some thought; but the last string consists of many spaces, so it would return everything after "13/04/2006 14:49:02 ACT DWE" as individul fields ....
I agree..just split with a space and contactenate first two splitted variables. Example:
Dim strSplit() as string
strSplit=split("13/04/2006 14:49:02 ACT DWE"," ")
This would return 4 values. Ignore last two and use only first two
strFinal = strSplit(0) & strSplit(1)
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

dwe0608Author Commented:

Thanks for the input ... how would you code splitting the entire string into the variables as I have suggested them ... ?
Dim strCommaSplit() as string
Dim strSpaceSplit() as string

strCommaSplit=split(2005443,"1/20050602104455/636","13/04/2006 14:49:02 ACT DWE : Printed:s80 - No Property",",")

strSpaceSplit=split(strCommaSplit(2)," ")
strFinal = strSpaceSplit(0) & strSpaceSplit(1)
I would recommend the following tweak:

Dim strCommaSplit() as string
Dim strColonSplit() as string
Dim strSpaceSplit() as string

strCommaSplit = Split(2005443,"1/20050602104455/636","13/04/2006 14:49:02 ACT DWE : Printed:s80 - No Property", ",")

strColonSplit() = Split(strCommaSplit(2), " : ")

strSpaceSplit=split(Trim(Mid$(strColonSplit(0), 20)), " " )

FileNum = strCommaSplit(0)
ClientRef = strCommaSplit(1)
DateTime = Left$(strColonSplit(0), 19)
Act = strSpaceSplit(0)
Author = strSpaceSplit(1)
Note = strColonSplit(1)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.