none
spilt all " from text file RRS feed

Answers

  • Hi

    Do you mean you want to REMOVE all ", or perhaps, REPLACE all " with a SPACE character - or something else?

    For example, a string which is    ABCD"EFGH

    do you want it to be ABCDEFGH? Or maybe ABCD EFGH?

    *

    Is the file the ssme one from the last thread where a new file called Combine.txt was produced - if so, then this can be done during that process.


    Regards Les, Livingston, Scotland



    • Edited by leshay Saturday, February 17, 2018 9:34 PM
    • Marked as answer by monemas Sunday, February 18, 2018 1:42 AM
    Saturday, February 17, 2018 9:32 PM
  • Hi

    OK, then here is the code I used before to create the Combined text file, but, this time, it removes all " characters as it is building the new file. Give it a try and you can see what is done in the code to do the removal of those " characters.

    Option Strict On
    Option Explicit On
    Public Class Form1
      'make your own paths here
      Dim SourcePath As String = "C:\Users\lesha\Desktop\Plans\New folder\TextFil"
      Dim DestPath As String = "C:\Users\lesha\Desktop\Combined.txt"
      Private Sub Form1_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown
    	Dim files As List(Of String) = IO.Directory.GetFiles(SourcePath, "*.txt", IO.SearchOption.TopDirectoryOnly).ToList
    	ProgressBar1.Maximum = files.Count
    	Dim lst As New List(Of String)
    	For Each f As String In files
    	  Dim lst2 As List(Of String) = IO.File.ReadAllLines(f).ToList
    	  For Each s As String In lst2
    		If Not lst.Contains(s) Then
    		  ' here is the REPLACE code
    		  lst.Add(s.Replace("""", Nothing))
    		End If
    	  Next
    	  ProgressBar1.Value += 1
    	Next
    	IO.File.WriteAllLines(DestPath, lst.ToArray)
      End Sub
    End Class


    Regards Les, Livingston, Scotland

    • Marked as answer by monemas Sunday, February 18, 2018 1:42 AM
    Sunday, February 18, 2018 12:52 AM

All replies

  • Hi

    Do you mean you want to REMOVE all ", or perhaps, REPLACE all " with a SPACE character - or something else?

    For example, a string which is    ABCD"EFGH

    do you want it to be ABCDEFGH? Or maybe ABCD EFGH?

    *

    Is the file the ssme one from the last thread where a new file called Combine.txt was produced - if so, then this can be done during that process.


    Regards Les, Livingston, Scotland



    • Edited by leshay Saturday, February 17, 2018 9:34 PM
    • Marked as answer by monemas Sunday, February 18, 2018 1:42 AM
    Saturday, February 17, 2018 9:32 PM
  • i want to remove all    "    from all text file


    You haven't indicated what the problem is.  Show the code you are using and indicate exactly where in that code you are running into the problem.
    https://msdn.microsoft.com/en-us/library/ms143368%28v=vs.110%29.aspx
    https://msdn.microsoft.com/en-us/library/fk49wtc1(v=vs.110).aspx
    https://msdn.microsoft.com/en-us/library/ms143375(v=vs.110).aspx

    Saturday, February 17, 2018 11:08 PM
  • Hi

    Do you mean you want to REMOVE all ", or perhaps, REPLACE all " with a SPACE character - or something else?

    For example, a string which is    ABCD"EFGH

    do you want it to be ABCDEFGH? Or maybe ABCD EFGH?

    *

    Is the file the ssme one from the last thread where a new file called Combine.txt was produced - if so, then this can be done during that process.


    Regards Les, Livingston, Scotland



    monem"alie "dhfbdjhbfhdjfbdjfd" ........  etic

    remove" dont replace with space

    monemaliedhfbdjhbfhdjfbdjfd

    Saturday, February 17, 2018 11:29 PM
  • Hi

    Fair enough, but, you have now introduced a new question.

    It appears that you also want to remove SPACE characters - is that right?


    Regards Les, Livingston, Scotland

    Saturday, February 17, 2018 11:44 PM
  • Hi

    Fair enough, but, you have now introduced a new question.

    It appears that you also want to remove SPACE characters - is that right?


    Regards Les, Livingston, Scotland

    no remove characters "   only
    Sunday, February 18, 2018 12:35 AM
  • Hi

    OK, then here is the code I used before to create the Combined text file, but, this time, it removes all " characters as it is building the new file. Give it a try and you can see what is done in the code to do the removal of those " characters.

    Option Strict On
    Option Explicit On
    Public Class Form1
      'make your own paths here
      Dim SourcePath As String = "C:\Users\lesha\Desktop\Plans\New folder\TextFil"
      Dim DestPath As String = "C:\Users\lesha\Desktop\Combined.txt"
      Private Sub Form1_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown
    	Dim files As List(Of String) = IO.Directory.GetFiles(SourcePath, "*.txt", IO.SearchOption.TopDirectoryOnly).ToList
    	ProgressBar1.Maximum = files.Count
    	Dim lst As New List(Of String)
    	For Each f As String In files
    	  Dim lst2 As List(Of String) = IO.File.ReadAllLines(f).ToList
    	  For Each s As String In lst2
    		If Not lst.Contains(s) Then
    		  ' here is the REPLACE code
    		  lst.Add(s.Replace("""", Nothing))
    		End If
    	  Next
    	  ProgressBar1.Value += 1
    	Next
    	IO.File.WriteAllLines(DestPath, lst.ToArray)
      End Sub
    End Class


    Regards Les, Livingston, Scotland

    • Marked as answer by monemas Sunday, February 18, 2018 1:42 AM
    Sunday, February 18, 2018 12:52 AM
  • Hi

    OK, then here is the code I used before to create the Combined text file, but, this time, it removes all " characters as it is building the new file. Give it a try and you can see what is done in the code to do the removal of those " characters.

    Option Strict On
    Option Explicit On
    Public Class Form1
      'make your own paths here
      Dim SourcePath As String = "C:\Users\lesha\Desktop\Plans\New folder\TextFil"
      Dim DestPath As String = "C:\Users\lesha\Desktop\Combined.txt"
      Private Sub Form1_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown
    	Dim files As List(Of String) = IO.Directory.GetFiles(SourcePath, "*.txt", IO.SearchOption.TopDirectoryOnly).ToList
    	ProgressBar1.Maximum = files.Count
    	Dim lst As New List(Of String)
    	For Each f As String In files
    	  Dim lst2 As List(Of String) = IO.File.ReadAllLines(f).ToList
    	  For Each s As String In lst2
    		If Not lst.Contains(s) Then
    		  ' here is the REPLACE code
    		  lst.Add(s.Replace("""", Nothing))
    		End If
    	  Next
    	  ProgressBar1.Value += 1
    	Next
    	IO.File.WriteAllLines(DestPath, lst.ToArray)
      End Sub
    End Class


    Regards Les, Livingston, Scotland

    Please disconnect the second code

    Responsible for the current request
    Where I want to edit and save the file after deleting "  only


    Sunday, February 18, 2018 1:07 AM
  • Please disconnect the second code

    Responsible for the current request
    Where I want to edit and save the file after deleting "  only

    Hi

    I do not understand your last post quoted above.

    I have made a guess, and here is some more code that will scan SourcePath and remove the " characters from all the lines and save to a new file DestPath.

    Public Class Form1
      'make your own paths here
      Dim SourcePath As String = "C:\Users\lesha\Desktop\Combined.txt"
      Dim DestPath As String = "C:\Users\lesha\Desktop\Combined2.txt"
      Private Sub Form1_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown
    	Dim lst As New List(Of String)
    	For Each s As String In IO.File.ReadAllLines(SourcePath).ToList
    	  ' here is the REPLACE code
    	  lst.Add(s.Replace("""", Nothing))
    	Next
    	'save to new DestPath
    	IO.File.WriteAllLines(DestPath, lst.ToArray)
      End Sub
    End Class


    Regards Les, Livingston, Scotland

    Sunday, February 18, 2018 12:30 PM