Search a string (1 Viewer)

bodhran1

Dazed and Confused
Local time
Yesterday, 19:12
Joined
Mar 27, 2002
Messages
43
Hi all,

I have a few strings of text in a ascii file that I'm reading with "Line Input".

Lets say they looks like this:

I put them into an array(?) like this:

Data(1) = C1, 1.23, 2.4, 10
Data (2) = C2, 8, 5.67, 8.5
etc....
etc....


I need to extract the third set of numbers (2.4 and 5.67) from each string.

They are never in the same location so Mid$ is useless.

I can write something to search each line until it gets to the second comma, then read until it hits the third. But that sounds slow and sloppy.

Is there a better way?


Thanks in advance.

Dave
 

StuBailey

Registered User.
Local time
Today, 00:12
Joined
Sep 20, 2001
Messages
15
You could split the array element into Sub elements using the Split() function and splitting on your comma.

You will then be able to get it by SubArray(1,3).

Have a look at the Split function in the VBA Help file and see if it will work for you.

Stu
 

Users who are viewing this thread

Top Bottom