Results 1 to 5 of 5

Thread: [RESOLVED] Isolating text strings from a file

Threaded View

  1. #4
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536

    Re: Isolating text strings from a file

    This is hideously bad code, but it works on the first example you gave.
    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Form_Load()
    4.   Dim strExample As String
    5.   Dim str1 As String
    6.   Dim str2 As String
    7.   Dim str3 As String
    8.   Dim slash As String
    9.   strExample = "Original problem gets listed, it's usually a fairly short string. XXX Problem gets some sort of update text. XXX Maybe some more update text gets added here. /// Then they close the problem report for that particular entry like this."
    10.   str1 = Left$(strExample, InStr(strExample, "XXX") - 1)
    11.   str2 = Mid$(strExample, InStr(strExample, "XXX") + 3, InStrRev(strExample, "XXX") - (InStr(strExample, "XXX") + 3))
    12.   If InStr(strExample, "///") > InStr(strExample, "\\\") Then
    13.     slash = "///"
    14.   Else
    15.     slash = "\\\"
    16.   End If
    17.   str3 = Right$(strExample, Len(strExample) - InStr(strExample, slash) - 2)
    18.   Debug.Print str1
    19.   Debug.Print str2
    20.   Debug.Print str3
    21. End Sub

    Also works for example in post #3 (with the last XXX removed).
    Last edited by trisuglow; Oct 17th, 2005 at 11:22 AM.
    This world is not my home. I'm just passing through.

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