[dba-VB] C# replace a special character

Stuart McLachlan stuart at lexacorp.com.pg
Thu Oct 22 15:57:31 CDT 2009


PB is still very much in use and undergoing continuous development. Latest version is 9.02

Combined it  with SQL Tools for ODBC connectivity and it rocks.

To quote from http://www.powerbasic.com

PowerBASIC 9 for Windows, our GUI compiler, creates applications and DLLs with the 
Windows look and feel. And PowerBASIC Forms, our Visual Dialog Designer, will have 
those GUI apps running in no time at all! For text mode, there's the PowerBASIC Console 
Compiler 5 -- no fluff, no animated puppets, just intense computing power. That's why it's 
said "We put the POWER in BASIC!".

These new versions sport a number of exciting new features. Both compilers can create 
client COM applications using Dispatch, Direct, Automation, or Dual interfaces. 

PowerBASIC 9 For Windows can create COM components (servers) using Dispatch, Direct, 
Automation, or Dual interfaces. The inline assembler has been expanded to support the full 
range of SIMD opcodes. A complete graphics engine, a printer package for Windows GDI 
host printers, dynamic pointers, and thread local storage, to name just a few.

Dynamic Dialog Tools has been expanded to support TreeViews, ListViews, ProgressBars, 
ToolBars, ImageLists, Tab controls, and much, much more.

The built in graphics engine has been expanded to support keyboard and mouse input with 
easy to use statements. The built in GDI printer engine has been expanded. Select the 
paper tray, set the paper size, turn duplexing on and off, enable or disable collating, and 
more.

Signed and unsigned bit variables, 1 to 31 bits wide, can be packed one after another in 
User-Types and Unions. We have FIELD string variables, and a FIELD statement for 
resizable data structures. Even THREADED variables for Thread Local Storage (data local 
to a thread). 

-- 
Stuart



On 22 Oct 2009 at 15:31, Mark Breen wrote:

> Hello Stuart,
> Have not heard of PowerBasic since 2001, is is still in use?  or is this an
> old language that you still use through familiarity?
> 
> Thanks
> 
> Mark
> 
> 
> 2009/10/20 Stuart McLachlan <stuart at lexacorp.com.pg>
> 
> > 200 megabytes tirivial.
> >
> > I just knocked this up in PowerBasic (this is the complete program!):
> >
> > #COMPILE EXE
> > #DIM ALL
> > FUNCTION PBMAIN () AS LONG
> >    LOCAL strFile AS STRING
> >    LOCAL lngSTart AS LONG
> >    LOCAL strData AS STRING
> >    strFile = "ML_Data.mdb"
> >    lngStart = TIMER
> >    OPEN strFile FOR BINARY AS #1
> >    GET$ #1, LOF(1), strData
> >    CLOSE #1
> >    REPLACE "A" WITH "B" IN strData
> >    OPEN strfile & "fixed" FOR BINARY as#1
> >    PUT$ #1, strData
> >    CLOSE #1
> >    MSGBOX "It took " & STR$(TIMER - lngstart) & " seconds"
> > END FUNCTION
> >
> > It compiles to an 11KB executable with no dependencies.
> >
> > It took 18 seconds to process ML_Data.mdb which is 774MB in size.  Most of
> > that time was
> > taken in reading and writing the file to/from memory.
> >
> >
> > --
> > Stuart
> >
> >
> > On 20 Oct 2009 at 15:53, jwcolby wrote:
> >
> > > 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.
> > > >
> > > _______________________________________________
> > > dba-VB mailing list
> > > dba-VB at databaseadvisors.com
> > > http://databaseadvisors.com/mailman/listinfo/dba-vb
> > > http://www.databaseadvisors.com
> > >
> >
> >
> > _______________________________________________
> > dba-VB mailing list
> > dba-VB at databaseadvisors.com
> > http://databaseadvisors.com/mailman/listinfo/dba-vb
> > http://www.databaseadvisors.com
> >
> >
> _______________________________________________
> dba-VB mailing list
> dba-VB at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-vb
> http://www.databaseadvisors.com
> 





More information about the dba-VB mailing list