Results 1 to 3 of 3

Thread: Looking for PART of a string in a file...

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2000
    Posts
    2

    Post

    In a program I'm using to edit certain aspects of a configuration file, I read the entire contents of the file into an array (each index representing one line of the array).

    Then, using a for loop I'd like to go through the array until I find a line that STARTS WITH "DataEntry1" (minus the quotes). The problem is there will probably be text AFTER that DataEntry1 like someone's name, or something like that.

    Basically, how do I find a string within a string. Using Perl this would be a lot easier for me, but I need to do this in VB for other reasons, obviously.

    Thanks
    -Morg

  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,175

    Post

    Look up the InStr function. Other useful functions for you will probably be Mid and/or Left. If you look up any one of them, you can easily find info on all of VBs built-in string functions.

    ------------------
    Marty
    What did the fish say when it hit the concrete wall?
    > > > > > "Dam!"

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2000
    Posts
    2

    Post

    You rock, thanks man

    I already knew about Left, Right, Mid, etc...

    Didn't know the "InStr" function existed. Helps a lot in my program. Thanks again

    -Morg

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