RE: Use of Mid Statement in VB.Net

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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.



.



Relevant Pages

  • Re: Java String comparison
    ... but kinda new to Java... ... pointer type, such as pointer to string (although it is ... an empty string to indicate it is set but is empty. ...
    (comp.lang.java.programmer)
  • Re: Java String comparison
    ... but kinda new to Java... ... pointer type, such as pointer to string (although it is ... an empty string to indicate it is set but is empty. ...
    (comp.lang.java.help)
  • Re: pass by reference in java?
    ... the same in Java? ... the value (either pointer or primitive) is passed. ... not have pointers to primitives, ... For example if you pass a string into a function and then change the string ...
    (comp.lang.java.programmer)
  • Re: Cloning and Distinct Copies of Objects
    ... 11/780 Assembler class in the 1980s), so I find there's a lot of times that ... lot of dangerous baggage that C added to the concept of "pointer", ... Java forces its references to either be ... Why do you want to avoid sharing String objects? ...
    (comp.lang.java.help)
  • Re: Efficency and the standard library
    ... loop will dereference a null pointer if argument strInstring is ... this code, out of adversarial hatred, envy and malice. ... Some C programmers in these threads would suggest const ... the output string. ...
    (comp.lang.c)