Results 1 to 6 of 6

Thread: [RESOLVED] Remove junk characters

  1. #1

    Thread Starter
    Frenzied Member cssriraman's Avatar
    Join Date
    Jun 2005
    Posts
    1,465

    Resolved [RESOLVED] Remove junk characters

    Hi all,

    Please look into the attached txt file. Open in in Notepad. it has some square boxes at end. I want to remove those junk characters completely from that file. i believe these are line endings. How can I remove those characters?

    Please help.
    Attached Files Attached Files
    CS

  2. #2
    Frenzied Member Andrew G's Avatar
    Join Date
    Nov 2005
    Location
    Sydney
    Posts
    1,587

    Re: Remove junk characters

    I don't seem to have any square boxes showing on mine. My notepad font is Arial, size 10, regular.

  3. #3

    Thread Starter
    Frenzied Member cssriraman's Avatar
    Join Date
    Jun 2005
    Posts
    1,465

    Re: Remove junk characters

    Do you have extra line spaces at the end of the file?

    I opened that file in some other text editor it showed as a line spaces.
    CS

  4. #4
    Frenzied Member Andrew G's Avatar
    Join Date
    Nov 2005
    Location
    Sydney
    Posts
    1,587

    Re: Remove junk characters

    Oh, k then.

    Well sorry for it being soo late, but for some reason the last two lines took up 55 characters .

    VB Code:
    1. Dim StrTxt As String
    2.  
    3. Open "D:\test.txt" For Input As #1
    4.         StrTxt = Input(LOF(1), 1)
    5. Close #1
    6.  
    7. While Right(StrTxt, 1) = Chr(10)    'chr(10) = Line feed
    8.     StrTxt = Mid(StrTxt, 1, Len(StrTxt) - 1)
    9. Wend
    10.  
    11. Open "C:\test.txt" For Output As #1
    12.     Print #1, StrTxt
    13. Close #1

  5. #5

    Thread Starter
    Frenzied Member cssriraman's Avatar
    Join Date
    Jun 2005
    Posts
    1,465

    Re: Remove junk characters

    OK! Great!

    I found a another solution that. But this is very nice.

    Thanks!
    CS

  6. #6
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: [RESOLVED] Remove junk characters

    You could also use Replace(Replace(text, Chr$(10), ""), Chr$(13), "") on each line (not on the entire text).

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