Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Removing line numbers from a text file

Status
Not open for further replies.

marine0411

Technical User
Jul 30, 2003
1
US
How do you write a function to remove line numbers from a text file with a random number of lines?
 
See thread707-615854 for a routine that processes a text file. You might be able to modify it to meet your needs.

 
Here is a easy solution if by "numbers" you mean [0..9] not including "."
function Delete0to9(byval s as string) as string
dim i as integer
for i = 0 to 9
s=replace(s, cstr(i),"")
next i
Delete0to8 = s
end function

I think Replace function allow you to replace all instance. If not, you have to check if numbers still exist and replace repeatly.

If your VB or VBA does not support Replace, check MS site:
I believe the best solution will be one that use RegExpression in VBScript. But could not remember the exact syntax.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top