CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Txt file

  1. #1
    Join Date
    May 2001
    Posts
    34

    Txt file

    I need to remove tripple commas and qotes, (,,, ")
    this is what i have so far.........

    Public Function SearchRep(strsour As String, strtarg As String, search As String, rep As String, yvar As Integer) As String

    Dim MyString As String
    Dim Newstring As String
    Dim Oneletter As String

    Dim Trip As String
    Dim x As Integer
    Dim y As Integer
    Dim z As Integer
    Dim supernewstring As String
    Dim strSearch As String
    Dim strRep As String


    Dim convertedname As String
    Dim ssourcefile As String
    Dim old As Integer

    strSearch = search
    strRep = rep
    convertedname = strtarg
    ssourcefile = strsour
    y = yvar
    old = y
    If convertedname <> "" Then
    Screen.MousePointer = vbHourglass
    Open convertedname For Output As #2
    Open ssourcefile For Input As #1 ' Open file.


    Do While Not EOF(1) ' Loop until End of file.
    Input #1, Newstring ' Read data into one variable.


    z = z + 1

    For x = y To Len(Newstring)
    Trip = ""

    y = y - 2
    'x = x - 2
    For z = 1 To 3


    Trip = Trip & Mid(Newstring, y, 1)
    y = y + 1
    Next z
    'z = 0

    Select Case (Trip)

    Case strSearch: Trip = strRep


    Newstring = Newstring & Trip
    End Select


    Next x



    Print #2, Newstring
    Newstring = ""


    DoEvents ' it is important To unlock the screen
    Loop
    Close #1 ' Close file.
    Close #2
    Screen.MousePointer = vbDefault
    'Else
    'MsgBox " Destination File Read Erorr.. "
    End If
    End Function


    can anyone help..........?

    thanx

    -DAVE

  2. #2
    Join Date
    Apr 2000
    Posts
    737

    Re: Txt file

    check the vb function call Replace. it might help.

    cksiow
    http://vblib.virtualave.net - share our codes


  3. #3
    Join Date
    Feb 2000
    Location
    Ireland
    Posts
    808

    Re: Txt file

    If you are using VB6 just use the replace function

    Mystring="Hello,,,"
    Mystring=Replace(Mystring,",,,","")
    'Will give you "Hello"





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

Featured