Parse a string ?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
How do I parse a string like this? "BR549OYP 200A CD/3C/05" I need to drop
everything to the left of the first space and everything to the right of the
first "/". The result in this example would be "200A CD". The number of
characters varies with each string. Any suggestions?
 
Use Instr() to locate the position of the space, and again for the slash.

Use Mid() to return the portion in between.
 
Thank you so much Mr. Browne.
John

Allen Browne said:
Use Instr() to locate the position of the space, and again for the slash.

Use Mid() to return the portion in between.
 
To parse out that string:

dim strTest as string
dim strResult as string


strTest = "BR549OYP 200A CD/3C/05"

strResult = split(strTest,"/")(0)
strResult = mid(strResult, instr(strResult," ") + 1)

the above should be 200A CD
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top