Results 1 to 2 of 2

Thread: grabbing certain parts of a string

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2004
    Posts
    9

    grabbing certain parts of a string

    I haven't been able to think of a good way to do this, so any advice would be appreciated. I have a text file that I want some data from. All the info I need is on the same line so I have a string that I obtained using StreamReader.ReadLine(), now I need to get certain parts of it and pass it to 3 variables. The string will be something like this "1 100 90 5 0" and I need the 100, the 90, and the 5 all passed as different variables. The thing is, there is no way to know how may digits each one will be, for instance it could be "1 1000 9 20 0". So I figured the best way to do it was to determine when a space occured and read until the next space occured to get a variable but I couldn't think of a good way to do that.

  2. #2
    Fanatic Member
    Join Date
    May 2005
    Posts
    898

    Re: grabbing certain parts of a string

    VB Code:
    1. Dim Vars() As String = YourLine.Split(" "c)
    "so just keep in mind that fantasy is not the same as realtiy and make sure u remember that wii sports may be fun but u cant count on it as exercise ok cool bye" - HungarianHuman

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