Structure ?

  • Thread starter Thread starter Phil Hunt
  • Start date Start date
P

Phil Hunt

Hi
I am trying to "map" a string into many fixed length fields so I don't have
to use substr repetively. I thought I could use Structure, but it does not
allow fix length field. Can you suggest a way to do this sort of thing ?
 
Phil Hunt said:
Hi
I am trying to "map" a string into many fixed length fields so I don't
have to use substr repetively. I thought I could use Structure, but it
does not allow fix length field. Can you suggest a way to do this sort of
thing ?

Strings are reference types. The Char type is a value type, but it can only
hold one character, unless you made a character array.

What exactly are you trying to accomplish? Since strings are classes, they
have a wide assortment of methods for parsing. The substr function of VB 6
still works, but you really don't need to use it any longer. You can use the
String methods.

If you'll be doing quite a few manipulations, you should look into the
StringBuilder class.

-Scott
 
I still find myself thinking in the old day where you can move a record into
a data structure and the structure will map out the offset and length for
you. It has a great advantage if something change, the offset is auto.

I don't think it has a similar constuct in .net or even VB6. (prob a lot of
work for little gain)

I just do substring then.
 
I still find myself thinking in the old day where you can move a record into
a data structure and the structure will map out the offset and length for
you. It has a great advantage if something change, the offset is auto.

I don't think it has a similar constuct in .net or even VB6. (prob a lot of
work for little gain)

I just do substring then.

I generally approach this with a class that understands the record layout, and
then parses into individual fields that can be accessed either by index, name,
or properties depending on the type of file...
 
Why not use ordinary strings? What is the feature of a fixed length string
that is important to this procedure, or what part of the procedure won't
work properly with variable length strings?
 
Back
Top