H
Harry Strybos
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.
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.