Sign in to follow this  
Followers 0
FiNAlzFiNAle

How to delete a character from a .txt file

4 posts in this topic

Hi,

I would like to know how can I delete a character from a text file using FileWrite.

Do I need to FileWrite the backspace character ? If yes then how ?

Thank You

Share this post


Link to post
Share on other sites



Hi,

I would like to know how can I delete a character from a text file using FileWrite.

Do I need to FileWrite the backspace character ? If yes then how ?

Thank You

Look closely
#include <file.au3>
Local $Path2File = 'Path2File'
Local $nArray = ''
Local $NEW_FILE = @DesktopDir & '\NEW_TXT.TXT'
_FileReadToArray($Path2File, $nArray)
For $i = 1 To UBound($nArray) - 1
    If StringInStr($nArray[$i], 'StringINeed2Find') Then
        $blah = $blah & StringReplace($nArray[$i], 'ChangeThis', '') & Chr(01)
        FileWriteLine($NEW_FILE, $blah)
    Else
        $blah = $blah & Chr(01)
        FileWriteLine($NEW_FILE, $blah)
    EndIf
Next
$blah = StringSplit(StringTrimRight($blah, 1), Chr(01))
For $x = 1 To UBound($blah) - 1
    FileWriteLine($NEW_FILE, $blah[$x])
Next

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

ok thank you !

Share this post


Link to post
Share on other sites

Your quite welcome... You might also want to take a close look at StringRegExpReplace()


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0