Solved

delete a row in a file

Posted on 2004-09-26
6
216 Views
Last Modified: 2010-04-23
I have a string like 2004-10-21 and the file looks like this

1999-01-01
2004-10-01
2004-09-30
2004-10-21

and i wan't to delete 2004-10-21 but leav the other dates intact how?
0
Comment
Question by:stromberg10
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 28

Accepted Solution

by:
iboutchkine earned 43 total points
ID: 12155988
You have to read file and write it to different file, When you found the string that you want to delete, don't write it. WHen you finished, delete the original file and rename the new one.
0
 
LVL 96

Assisted Solution

by:Bob Learned
Bob Learned earned 41 total points
ID: 12157004
Do you know how to read text files?  Is it possible to have multiple dates the same.  You could read the entire contents of the file into a string, replace the string with nothing, and then write the string back to the file.

Bob
0
 
LVL 10

Assisted Solution

by:123654789987
123654789987 earned 41 total points
ID: 12159293
try this. This is the code to remove the third string - 2004-09-30


                                                 str1 as string
                  str2 as string

                  str1 = "1999-01-01     2004-10-01    2004-09-30  2004-10-21"

            
                  length as int
                  fourthString as int

                  length = str1.Length()
                  fourthString = str1.IndexOf("2004-10-21")

                  str2 = str1.Remove(fourthString , length-fourthString) // This gives the final output string

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question