Adblock breaks this site

Editing Text File

Discussion in 'Programming General' started by WalangAlam, Mar 19, 2007.

  1. WalangAlam

    WalangAlam Guest

    Referrals:
    0
    Editing Text File

    got text file sos.dlm and some of the line contain *. I want to change all the asterisk to 0

    -content of my text file -----------------
    "2073308","4","2","1","2","1","1","4","4","2","1", "2","4","*","4","2","1","1","1","1"
    "2074698","4","2","4","4","3","4","*","3","4","1", "3","4","4","4","4","4","4","*","4
    "2074655","2","1","4","3","2","4","2","2","2","*", "3","3","3","4","3","3","4","3","4"
    ---------------------------------------

    tried this code but did NOT work for me.

    Private Sub Edit_Text_File()
    Dim sFileText As String = My.Computer.FileSystem.ReadAllText(sTextFileNamePa th)
    sFileText.Replace("*", "0")
    My.Computer.FileSystem.WriteAllText(sTextFileNamePath, sFileText, False)
    MessageBox.Show("Okley")
    End Sub
     
  2. Flaming Idiots

    Flaming Idiots Active Member
    Visual Basic Programmers

    Joined:
    Dec 22, 2005
    Posts:
    235
    Referrals:
    1
    Sythe Gold:
    0
    Two Factor Authentication User
    Editing Text File

    You need to do:
    sFileText = sFileText.Replace("*", "0")

    I make that mistake sometimes too.
     
  3. Swan

    Swan When They Cry...
    Retired Global Moderator

    Joined:
    Jan 23, 2007
    Posts:
    4,957
    Referrals:
    0
    Sythe Gold:
    0
    Sythe's 10th Anniversary Member of the Month Winner
    Editing Text File

    yup, as F/I said.

    Sort of off topic, but that is one intriguing number set, whats the story with it?
     
  4. WalangAlam

    WalangAlam Guest

    Referrals:
    0
    Editing Text File

    Thanks much. It worked! And your reply here is faster than other forum sites. Guess i will be a regular here.

    That's a delimited output file from an OMR Pearson Scanner. I'm converting it to .mdf file in an integer field. My conversion code rejects * to be placed in an integer field so i got to change * first to 0 before conversion.

    Thanks much for the fast and accurate response.
     
< Force Windows 95/98 to crash on startup | [Source] Basic History system using the computer registry >


 
 
Adblock breaks this site