[dba-VB] C# replace a special character

jwcolby jwcolby at colbyconsulting.com
Tue Oct 20 14:53:22 CDT 2009


It is my guess that Regex will be too slow.  This will be a file with about 100 characters average 
per line, 2 million lines.  Doing this in one big read MIGHT be possible (and I will try) but 
reading in 200 million bytes all at once could cause issues.

John W. Colby
www.ColbyConsulting.com


Jack and Pat wrote:
> John,
> 
> I did a google search to find this link. I'm not a C# person, but thought
> I'd pass this on
> 
> http://dotnetperls.com/regex-replace-1
> 
> -----Original Message-----
> From: dba-vb-bounces at databaseadvisors.com
> [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby
> Sent: Tuesday, October 20, 2009 11:45 AM
> To: VBA
> Subject: [dba-VB] C# replace a special character
> 
> I have a file which contains a sprinkling of a special character - decimal
> 26, hex 1A (the SUB 
> character).  This special character in the CSV file output to Accuzip causes
> Accuzip to hiccup.  In 
> order to get on with my life I need to pre-process the files to get rid of
> this special character. 
> Because of the size of these files (hundreds of mbytes) I need to do a
> readline / replace / 
> writeline kind of thing.  I think I need to use the stringbuilder.replace
> but I do not know how to 
> specify replacing this hex 1A with something else.  The something else would
> ideally be nothing 
> (empty string) but can be any valid alpha character (A, B etc).
> 
> Can anyone help me with this replace part of the problem.  C# syntax please.
> 



More information about the dba-VB mailing list