|
-
Oct 17th, 2005, 11:08 AM
#1
Thread Starter
Member
-
Oct 17th, 2005, 11:11 AM
#2
Re: Isolating text strings from a file
Post a block that you want to parse
-
Oct 17th, 2005, 11:18 AM
#3
Thread Starter
Member
Re: Isolating text strings from a file
4320010205 N/ADURING NORMAL OPERATION, DISCOVERED MALFUNTIONING * IN SUPPLY OFFICE. UPON INVESTIGATION FOUND WORN GEARS DUE TO BROKEN TENSION SPRING.
XXX REQUEST NEW * FROM SUPPLY SYSTEMTO REPAIR STATION IN SUPPLY OFFICE.XXX SUPPLY INDICATES NO * LEFT ON BOARD, REQUEST TO RECEIVE PARTS DURING PORT CALL.\\\XXX PARTS RECEIVED ALL WORK COMPLETED, NO FURTHER ACTIONS REQUIRED.
This is what one typically looks like. The * is text I removed. Can't let everyone see that stuff .
The "XXX" at the end after "\\\" would be removed in the viewer before export.
-
Oct 17th, 2005, 11:19 AM
#4
Re: Isolating text strings from a file
This is hideously bad code, but it works on the first example you gave.
VB Code:
Option Explicit
Private Sub Form_Load()
Dim strExample As String
Dim str1 As String
Dim str2 As String
Dim str3 As String
Dim slash As String
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."
str1 = Left$(strExample, InStr(strExample, "XXX") - 1)
str2 = Mid$(strExample, InStr(strExample, "XXX") + 3, InStrRev(strExample, "XXX") - (InStr(strExample, "XXX") + 3))
If InStr(strExample, "///") > InStr(strExample, "\\\") Then
slash = "///"
Else
slash = "\\\"
End If
str3 = Right$(strExample, Len(strExample) - InStr(strExample, slash) - 2)
Debug.Print str1
Debug.Print str2
Debug.Print str3
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.
-
Oct 17th, 2005, 11:42 AM
#5
Thread Starter
Member
Re: Isolating text strings from a file
Yep, works like a charm. Now I just have to figure a way to work with the inconsistencies of the reporting.
Thanks!
John
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|