RE: Use of Mid Statement in VB.Net
- From: David Anton <DavidAnton@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 9 Oct 2009 07:58:02 -0700
It's not clear from your original post, but the Mid statement is still
available in VB (.NET) ?
(It can also be used from other .NET languages, is well-tested, and is
easier than writing from scratch).
--
David Anton
http://www.tangiblesoftwaresolutions.com
Convert VB to C#, C++, or Java
Convert C# to VB, C++, or Java
Convert C++ to C#, VB, or Java
Convert Java to C#, C++, or VB
"Harry Strybos" wrote:
Hi All.
If anyone has the time, I think feedback on the following may be of interest
to all:
I have to build a lot of bank files which are generally of the fixed length
field type eg aba format. The beauty of the old VB6 Mid statement (which is
available in VB.Net) is that it allows me to replace n chars at a specified
position in a string eg
'(air code)
Private Enum MyFields
mfRecordType = 1
mfTransactionType = 2
'etc
End Enum
Dim buffer as New String(120, " "c)
Dim pointer as Integer = 1
Mid(buffer, pointer, MyFields.mfRecordType) = "A"
pointer += MyFields.mfRecordType
Mid(buffer, pointer, MyFields.mfTransactionType ) = "AB"
pointer += mfTransactionType 'etc etc
There appears no native VB.Net equivalent to this method. The StringBuilder
Class does not have this method either. It should be noted that the Replace
method for either String or StringBuilder would not be appropriate for the
above.
The above algorithm that I use will actually write several thousands records
to file in very fast time (around or under 1 second)
As I have stated, this whole question is of an academic nature. Having said
that, is there any equivalent method (as used above) for the Mid Statement
in VS (any language)?
Thanks for your time.
- Follow-Ups:
- Re: Use of Mid Statement in VB.Net
- From: Armin Zingler
- Re: Use of Mid Statement in VB.Net
- From: Mike Williams
- Re: Use of Mid Statement in VB.Net
- References:
- Use of Mid Statement in VB.Net
- From: Harry Strybos
- Use of Mid Statement in VB.Net
- Prev by Date: Re: An array of datasets/tables ? (Aussie Rules=Your name here)
- Next by Date: Re: DataGridView in Vb.NET
- Previous by thread: Re: Use of Mid Statement in VB.Net
- Next by thread: Re: Use of Mid Statement in VB.Net
- Index(es):
Relevant Pages
|