week,
It would help if you came up with at least 2 strings so we could know if the placings of the things you want to extract are standard or not.
First, for instance, lets say the the part that holds 'PEPSI' (i.e. the first part up until 'IL') can hold up to 9 characters. Then
[tt]
TRIM(MID$ ("Pepsi ILMutual 2003/07/01249",1 ,9))
[/tt]
(Taking 9 consecutive characters starting from the First and removing any redundant spaces)
-OR-
[tt]
TRIM(LEFT$ ("Pepsi ILMutual 2003/07/01249", 9))
[/tt]
(Taking the 9 Leftmost Characters and removing any redundant spaces)
Both will work fine, providing 9 is the correct amount.
Now, staying on the basis that is 9 character spaces at the start (including your PEPSI) then the Characters 'IL' Will be character numbers 10 and 11, so...
[tt]
TRIM(MID$ ("Pepsi ILMutual 2003/07/01249", 10, 2))
[/tt]
(Taking 2 Consecutive Characters starting at the 10th and removing any redundant spaces)
is what you need.
Next, assuming the space containing 'Mutual' can hold 12 Characters and, of course, that previous assumptions are correct, then to return 'Mutual' this you need...
[tt]
TRIM(MID$ ("Pepsi ILMutual 2003/07/01249", 12, 12))
[/tt]
(Taking 12 Consecutive Characters starting at the 12th and removing any redundant spaces)
Lastly, If the amount of Numbers at the end are standard then the following functions
[tt]
TRIM(RIGHT ("Pepsi ILMutual 2003/07/01249", 14))
[/tt]
(Taking the 14 rightmost characters and removing any redundant spaces)
-OR-
[tt]
TRIM(MID$ ("Pepsi ILMutual 2003/07/01249", 24, 14))
[/tt]
(Taking 14 Consecutive Characters starting at the 24th and removing any redundant spaces)
will both return [tt] "2003/07/01249" [/tt]
A Final Note, when using String Manipulation Functions, it's always good practice to store your string in a variable first, for example,
[tt]
DIM strMyString as String
strMyString = "Pepsi ILMutual 2003/07/01249"
[/tt]
Then use this variable in the functions, for example...
[tt]
TRIM(MID$ (strMyString, 24, 14))
[/tt]
Hope this helps, if you need any more help email me.
===========QUOTE=============
"Pepsi ILMutual 2003/07/01249"
I will need to extract Pepsi, IL, Mutual, 2003/07/01249 separately. There are more than one blank spaces where it's blank
=========END QUOTE===========
¥oshi
-------------------------
"There is No Spoon.."
-------------------------