Results 1 to 11 of 11

Thread: problem with strings, code included

  1. #1

    Thread Starter
    Hyperactive Member schuurke28's Avatar
    Join Date
    Feb 2001
    Posts
    402

    Exclamation problem with strings, code included

    i need to get information from different records in one record.
    There are some restrictions:
    the first character of the record must be the same
    the second until the 21st character must be the same
    the information i have to put together starts from position 33
    the startposition of this information may never be the same.
    i.e.:
    0800100
    0800100
    In the attachement you will find the begin situation and the desired situation.


    This is the code i'v made this far:

    Sub Main()
    Dim i As Integer

    sOldfile1 = "c:\floreac\flores2.txt"
    sFile2 = "c:\floreac\flores2.dat"
    Open sOldfile1 For Input As #1
    Open sFile2 For Output As #2

    Line Input #1, sstring
    sTOREString = sstring
    Do While Not EOF(1) ' Check for end of file.

    Line Input #1, sstring

    strTempstring = Mid(sTOREString, 22, 61)
    strTempstring2 = Mid(sstring, 22, 61)
    lengte1 = Len(RTrim(strTempstring))
    lengte2 = Len(RTrim(strTempstring2))

    If (Left(sTOREString, 15) = Left(sstring, 15)) Then
    If (Mid(sTOREString, 16, 6) = Mid(sstring, 16, 6)) Then
    If (Left(sTOREString, 1) = Left(sstring, 1)) Then
    If (lengte1 <> lengte2) Then

    header = Mid(sTOREString, 2, 20)
    links = RTrim(strTempstring)
    rechts = LTrim(strTempstring2)
    sTOREString = header & links & rechts
    Debug.Print sTOREString

    End If
    End If
    Else
    Print #2, sTOREString
    sTOREString = sstring
    End If

    End If


    Loop


    Close #1
    Close #2



    End Sub
    Attached Files Attached Files
    Last edited by schuurke28; May 15th, 2001 at 03:15 AM.

  2. #2

    Thread Starter
    Hyperactive Member schuurke28's Avatar
    Join Date
    Feb 2001
    Posts
    402
    can anybody help me plz? This is very urgent.
    ideas or functions i better use are also welcome.
    I think the problem i've got is to print the storestring at the right time.

  3. #3

    Thread Starter
    Hyperactive Member schuurke28's Avatar
    Join Date
    Feb 2001
    Posts
    402
    nobody??

  4. #4

    Thread Starter
    Hyperactive Member schuurke28's Avatar
    Join Date
    Feb 2001
    Posts
    402
    can anyone tell me what i must do when:
    1. the first if structure isn't true
    2. the second if structure isn't true

    must i print the record and name storestring into sstring?
    I've tried this but it doesn't work, really getting desperate on this one.

  5. #5

    Thread Starter
    Hyperactive Member schuurke28's Avatar
    Join Date
    Feb 2001
    Posts
    402
    help me pleaaaaaaaaaaaaaaaaaaaaaaaaaaaaase

  6. #6
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    Can probably help you.

    One thing though, with the space in the text file, does that symobolize the end of a piece of text?

    the first character of the record must be the same
    the second until the 21st character must be the same
    the information i have to put together starts from position 33
    the startposition of this information may never be the same.

    does this mean that anything after a space, cannot appear twice in the final string?

  7. #7

    Thread Starter
    Hyperactive Member schuurke28's Avatar
    Join Date
    Feb 2001
    Posts
    402
    that's right.

  8. #8

    Thread Starter
    Hyperactive Member schuurke28's Avatar
    Join Date
    Feb 2001
    Posts
    402
    really need an answer on this one....

  9. #9

    Thread Starter
    Hyperactive Member schuurke28's Avatar
    Join Date
    Feb 2001
    Posts
    402
    willing to sell my wife for an answer :-)

  10. #10
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390
    OUCH! is all i can say...

    the space between the left numberset and right numberset:

    is it a set distance?
    it seems to determine then position of the numbers when added togethr
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  11. #11
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    Code:
    txtOutput = ""
    Dim strList As Variant
    strList = Split(txtInput, " ")
    For Each varlist In strList
        If InStr(1, txtOutput, varlist) = 0 Then
            txtOutput = txtOutput & varlist & vbCrLf
        End If
    Next

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