Trancedified
asked on
Parsing/Extracting string
Hello,
I have this string:
Dim strFileLine As String
strFileLine = "0&²uŽfϦ٠ª bÎlÎ @¤ÐÒãÒ—ð É^¨P O L Y M P U S âdss 4692 þÿÿÿÿÿ04062911501504062911 5019000004 ÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿ, ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ j ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿ "
Yeah I know it's dirty. I need to extract the numbers 4692 from "O L Y M P U S âdss 4692"
And also:
04062911501504062911501900 0004
Any ideas?
Chris
I have this string:
Dim strFileLine As String
strFileLine = "0&²uŽfϦ٠ª bÎlÎ @¤ÐÒãÒ—ð É^¨P O L Y M P U S âdss 4692 þÿÿÿÿÿ04062911501504062911
Yeah I know it's dirty. I need to extract the numbers 4692 from "O L Y M P U S âdss 4692"
And also:
04062911501504062911501900
Any ideas?
Chris
If the strings you want are always in the same position, then open the file in binary mode, read in the areas you want as byte fields, then use the CHR() function to convert them back to characters.
ASKER
The file opens in binary but not all the way, it only gives me: 0&²uŽfϦ٠ª bÎl (the first few characters)
I had to do it another way. But yeah the things i want to extract are all in the same position.
Do you have an example after the file is read?
Chris
I had to do it another way. But yeah the things i want to extract are all in the same position.
Do you have an example after the file is read?
Chris
for 4692
debug.print Mid(strFileLine, InStr(strFileLine, "4692", 4)
for
debug.print Mid(strFileLine, InStr(strFileLine, "0406291150150406291150190
ASKER
PePi,
4692 might be a different ID number, can that "pickup" 4 numbers?
for
04062911501504062911501900 0004 same thing (Can it "pickup" just those numbers? and not necessarily "0406291150150406291150190 00004")???
chris
4692 might be a different ID number, can that "pickup" 4 numbers?
for
04062911501504062911501900
chris
sorry, i did not understand the problem properly.
are these values in the same position all the time? and is the length fixed?
are these values in the same position all the time? and is the length fixed?
ASKER
yes for both :) IT's ok my fault for not explaining too well
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for the advice :)