euverve Posted March 18, 2009 Posted March 18, 2009 How could i delete a line in a text file that starts with a backslash? Thanks
foster74 Posted March 18, 2009 Posted March 18, 2009 Here's an example: #Include <Array.au3> #Include <File.au3> $file1 = FileOpenDialog("Input", @scriptdir, "Text Documents (*.txt)", 1) $file2 = FileOpenDialog("Output", @scriptdir, "Text Documents (*.txt)", 1) Dim $array _FileReadToArray($file1,$array) Dim $NewArray[1] For $i = 1 to $array[0] If Stringleft($array[$i], 1) <> "/" Then _Arrayadd($NewArray, $array[$i]) Next _arraydelete($NewArray,0) _FileWriteFromArray($file2,$NewArray)
euverve Posted March 18, 2009 Author Posted March 18, 2009 Here's an example: #Include <Array.au3> #Include <File.au3> $file1 = FileOpenDialog("Input", @scriptdir, "Text Documents (*.txt)", 1) $file2 = FileOpenDialog("Output", @scriptdir, "Text Documents (*.txt)", 1) Dim $array _FileReadToArray($file1,$array) Dim $NewArray[1] For $i = 1 to $array[0] If Stringleft($array[$i], 1) <> "/" Then _Arrayadd($NewArray, $array[$i]) Next _arraydelete($NewArray,0) _FileWriteFromArray($file2,$NewArray) Thanks for the quick answer, it works... Thanks for the help foster74.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now