Ronda,
Try this. It will scoot through the string and only add non-space
strings. The one thing to note is that it will split a person's name
also, so if you get someone with a middle name, you will get more
items back in the arraylist.
Private Function ParseLine(line as string) as ArrayList
Dim al as ArrayList = new ArrayList()
Dim tmp() As String
Dim i As Integer
tmp = Regex.Split(line, "[\s]")
For i = 0 To tmp.Length - 1
If tmp(i).Length > 0 Then
al.Add(tmp(i))
End If
Next
Return al
End function
On Mon, 28 Feb 2005 15:23:29 -0600, Ronda K <[EMAIL PROTECTED]> wrote:
>
> Jason,
>
> If I do an actual import and map the fields you are right I could come
> up with a format that I could read. Do you see any way to parse the
> text file without importing into Excel - I was trying to avoid that
> step for the end user. They just wanted to upload and process.
> Curious though that you saw the pattern (e.g. field on 16 characters)
> - I guess I have been looking at this file too long and didn't see the
> pattern so I will reexamine it ... if that is the case then I can just
> parse at specific characters.
>
> I am still interested in knowing though if one can parse and just pick
> up the next character after a string of white space ....
>
> Ronda
>
>
> On Mon, 28 Feb 2005 21:16:51 -0000, Jason Handby <[EMAIL PROTECTED]> wrote:
> >
> > Hi Ronda,
> >
> > It looks to me like your fields are at fixed column positions -- i.e. the
> > first field starts at character 1, the next field starts at character 16...
> > So I think what you need to do is to select "fixed-width" as your format
> > type when you open the file in Excel. You should then be able to drag some
> > little sliders around in the import dialog to show Excel where each column
> > of data begins and ends.
> >
> > I've just copied the data from your email, pasted it into a text file and
> > read it into Excel, and it was very easy. (I'm using Excel 2003 but I'm
> > pretty sure older versions will cope with this too.)
> >
> > Jason
> >
> > _____
> >
> > From: Ronda K [mailto:[EMAIL PROTECTED]
> > Sent: 28 February 2005 15:53
> > To: [email protected]
> > Subject: [AspNetAnyQuestionIsOk] Parsing Text Files
> >
> > I am dealing with a text file that contains shipping information it is
> > coming out of a very archaic system. The file looks something like
> > this:
> >
> > RPS AIR-PP SL29799EA DEBBIE RUSKOWSKY 23322
> > 3.00 .00 055108800099191 996060 86658
> > RPS AIR-PP SL33098 MICHAEL DEMERS 80631
> > 2.00 .00 055108800099153 997340 86658
> > RPS AIR-PP SL33103 PASITHORN SUWANABOL 53705
> > 4.00 .00 055108800099221 998460 86658
> > RPS AIR-PP SL33104 LISA PAYTON 33133
> > 3.00 .00 055108800099207 998470 86658
> > RPS AIR-PP SL33108 PHILIP ALVAREZ-CORREA 03741
> > 3.00 .00 055108800099214 998630 86658
> >
> > If you open it in Excel each line reads in one cell indicating that
> > there is not a tab character in there. This is confirmed when I try
> > to create an array and break it on chr(32). I have also tried to
> > create an array and break it on chr(9) but that is not working either
> > - I get way too many fields. How do I specify to break on the next
> > non-space character? I need to get out the shipping method, order #
> > and tracking # when it is all said and done.
> >
> > TIA,
> >
> > --
> > Ronda Pederson
> > MVP ASP.Net
> >
> > Yahoo! Groups Sponsor
> >
> > ADVERTISEMENT
> >
> > <http://us.ard.yahoo.com/SIG=1296ve9cq/M=298184.6018725.7038619.3001176/D=gr
> > oups/S=1705006764:HM/EXP=1109692416/A=2593423/R=0/SIG=11el9gslf/*http://www.
> > netflix.com/Default?mqso=60190075> click here
> >
> > <http://us.adserver.yahoo.com/l?M=298184.6018725.7038619.3001176/D=groups/S=
> > :HM/A=2593423/rand=880398972>
> >
> > _____
> >
> > Yahoo! Groups Links
> >
> > * To visit your group on the web, go to:
> > http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
> >
> > * To unsubscribe from this group, send an email to:
> > [EMAIL PROTECTED]
> > <mailto:[EMAIL PROTECTED]
> > e>
> >
> > * Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
> > <http://docs.yahoo.com/info/terms/> .
> >
> >
> > [Non-text portions of this message have been removed]
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
>
> --
> Ronda Pederson
> MVP ASP.Net
>
> Yahoo! Groups Links
>
>
>
>
>
--
Dean Fiala
Very Practical Software, Inc
http://www.vpsw.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/