Results 1 to 4 of 4

Thread: [RESOLVED] [2005] How to remove from each line

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2007
    Location
    Silly Clone Valley CA
    Posts
    47

    Resolved [RESOLVED] [2005] How to remove from each line

    Lets say I have a text file that has 30 to 40 lines in it. Each line looks something like this:

    2019562.121 * The dude walked the dog 10 times

    how would I remove everything before the asterisk in each line?

    Thanks for any help
    My Languages: English, VB 2005, Perl
    My Hobbies: Code, Photoshop, Skateboarding, Video Games, Flying, Cars(modification), Airbrushing, Electronic music DJing, and production.

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [2005] How to remove from each line

    As you loop through file, you can read each line into a string variable and then

    strx.Substring(strx.IndexOf("*") + 1)

  3. #3

    Thread Starter
    Member
    Join Date
    Jul 2007
    Location
    Silly Clone Valley CA
    Posts
    47

    Re: [2005] How to remove from each line

    thanks, as soon as I wrote this post I realized I could just do this:
    Code:
            
    Dim text As String
    Dim oread As IO.StreamReader
    oread = IO.File.OpenText("blahblahblah.txt")
    Dim textcut As String
            While oread.Peek <> -1
                text = oread.ReadLine
                textcut = text.Remove(0, 15)
                txt2.Text = txt2.Text & vbCrLf & textcut
            End While
    My Languages: English, VB 2005, Perl
    My Hobbies: Code, Photoshop, Skateboarding, Video Games, Flying, Cars(modification), Airbrushing, Electronic music DJing, and production.

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [RESOLVED] [2005] How to remove from each line

    Yeah, simple solutions are the best.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width