CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2006
    Posts
    8

    Replace Characters

    Hi, I need some help, i have to replace some bad characters like this "©" to this "é", i have 43 characters, can anyone help me.
    The input file is a Txt file.

    Thanks.

  2. #2
    Join Date
    May 2002
    Posts
    10,943

    Re: Replace Characters

    What is wrong with the Replace command?
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3
    Join Date
    Jan 2006
    Posts
    8

    Re: Replace Characters

    I think i have a sintax problem.

  4. #4
    Join Date
    Sep 2005
    Location
    Delhi, INDIA
    Posts
    237

    Thumbs up Re: Replace Characters

    Hi Nanuk, Welcome to Codeguru !

    I Hope the following example will help to you at all,

    Code:
    Private Sub Command1_Click()
    	Dim variable1 As String
    	Open App.Path & "\sample.txt" For Input As #1
    	
    		Do Until EOF(1)
    			'Does this loop until ' f>End Of File(' >EOF) for file number 1.
    			Line Input #1, Data
    			'Read one line and puts it into the vari
    			' ble Data.
    			variable1 = variable1 & vbCrLf & Data
    			'Adds the read line into Text1.
    			'MsgBox EOF(1)
    		Loop
    	Close #1
    	
    	Text1.Text = Replace(variable1, "©", "é")
    End Sub
    I opened a Smaple.txt file containing the following text;
    "adadad©asd
    ©adas
    ddd
    asd
    ©
    sdadkahd"


    and when you will use the above code given here, it will changed to;

    "adadadéasd
    éadas
    ddd
    asd
    é
    sdadkahd"


    So that means, you can easily use 'replace' for your codin purpose, convey me , if it works for you!

    Happy Coding !!

    Quote Originally Posted by nanuk
    Hi, I need some help, i have to replace some bad characters like this "©" to this "é", i have 43 characters, can anyone help me.
    The input file is a Txt file.

    Thanks.
    I'M BACK AGAIN !!
    -------------------------------------------------------------------------
    enjoy the VB !
    If any post helps you, please rate that.
    Always try to findout the Solutions, instead just discussing the problem and its scope!

  5. #5
    Join Date
    Jan 2006
    Posts
    8

    Re: Replace Characters

    thanks a lot it works.

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