Parse a string ?

J

John G

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?
 
A

Allen Browne

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

Use Mid() to return the portion in between.
 
J

John G

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.
 
A

Albert D. Kallal

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
 
Top