string manipulation - interesting

DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: string manipulation - interesting

  1. #1
    Join Date
    May 2005

    Thumbs up string manipulation - interesting

    Dear all,

    This problem if solved will be very handy for people dealing with modeling and simulation stuff. I attached a txt file, which is the results of a simulation that I'm working on. I will need to extract out a certain value from the matrix(end of the text file) to do some calculation. And, I have 500 of these results. So, I hope to develop a VB program to do this for me.

    So, the problem is:
    How can I extract the second row and third column value (-58.38) and store it in a variable for certain calculation?

    Take a look on the txt file. This value is located at the end of the text file, the capacitance matrix. However, it does not always fall on the same line. So, if possible the best bet is to let VB detect the keyword, "GNDL%GNDL" and then go to the third column to grab the value.

    Hope someone can guide me out~!

    Kok Wai
    Attached Files Attached Files

  2. #2
    Join Date
    Oct 2005
    try this :

    Open "C:\output_mucluster_substrate.txt" For Input As #1
    Dim row As String
    Dim found As Boolean
    Do Until EOF(1)
       Line Input #1, row
       If Left(row, 9) = "GNDL%GNDL" Then found = True: Exit Do
    Close #1
    If (found) Then
       Dim i As Integer
       For i = 1 To Len(row)
          While Mid(row, i + 2, 1) = " "
             row = Left(row, i) & Mid(row, i + 2)
       Dim col() As String
       col = Split(row, " ")
       If UBound(col) = -1 Then
          MsgBox "Can't find column !"
          MsgBox "Value is=" & col(4) 'change 4 by any value u want
       End If
       MsgBox "Can't find row !"
    End If
    changing the value of "4" and "GNDl..." will be general case .
    Programmer&Cracker CS

Similar Threads

  1. Replies: 1
    Last Post: 06-05-2001, 07:12 AM
  2. verify local admin
    By Patrick Comeau in forum VB Classic
    Replies: 6
    Last Post: 03-22-2001, 11:50 PM
  3. How do I detect an FTP timeout?
    By Julian Milano in forum VB Classic
    Replies: 2
    Last Post: 08-11-2000, 01:11 PM
  4. How do I detect an FTP timeout?
    By Julian Milano in forum VB Classic
    Replies: 0
    Last Post: 08-10-2000, 10:16 PM
  5. Replies: 0
    Last Post: 06-22-2000, 08:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center