Results 1 to 2 of 2

Thread: Getting values from a string...

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 1999
    Posts
    51

    Post

    I'm getting some data returned to me that looks like this:
    Code:
    F:c:\myfile.ext   M:300   T:654654065 120 TEST   Y:EXT
    Each uppercase letter combined with a ':' represents a different field. Is there an easy way to extract these field values and put them in a format like this:
    Code:
    Filename:     c:\myfile.ext
    Number:       300
    Value:        654654065 120 TEST
    etc...
    There must be an easy way to get those values but I don't know how. Thanks for your help!

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    Post

    here's one method:


    mystring = "F:c:\myfile.ext M:300 T:654654065 120 TEST Y:EXT"
    Filename = Trim(Mid(mystring, 2, InStr(mystring, "M:") - 2))
    mystring = Mid(mystring, Len(Filename))

    Number = Trim(Mid(mystring, 2, InStr(mystring, "T:") - 2))
    mystring = Mid(mystring, Len(Number))
    Value: = Trim (Mid(mystring, 2, InStr(mystring, "Y:") - 2))

    etc....
    this may need tweeking a bit


    ------------------
    Mark Sreeves
    Analyst Programmer

    [email protected]
    A BMW Group Company

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