Solved

delete a row in a file

Posted on 2004-09-26
6
209 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
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Help with opening combobox using VB.NET. 3 26
VB.net Progress Bar - Maximum Value too large 2 16
Iteration Help (Asp.net VB) 5 25
Code enhancement 4 22
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…
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

821 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