RightFill?

  • Thread starter Thread starter Wapiti
  • Start date Start date
W

Wapiti

CF VB.NET

I'm filling up a fixed length field format string. As I'm appending the
text fields, I need to pad them on the right with spaces to a given length.

ie. sPartNo is 15 chars. A part no of "PX-22", needs to be written to the
line as "PX-22 ". This field will then be appended to a string
variable, where other fields will be appended.

strRec = "A"
strRec += rFill(sPartNo, " ", 15)
strRec += rFill(sQty, " ", 9) ...

rFill is a function I wrote and used in VB6.

From what I've seen with .net, there must be a method to do this easier than
before.

Is there?

Thanks.
 
Hmm, never seen that one. But worthy of a look. thx

I was writing back to say I found the padright method of a string var. Very
cool.
 
Nice. There are usually a whole bunch of different ways to accomplish the
same task with the framework. I often find that the trouble is in
determining the *best* one for a given situation.

--
Tim Wilson
..Net Compact Framework MVP

<Feedback>
Do have an opinion on the effectiveness of Microsoft Windows Mobile and
Embedded newsgroups? Let us know!
https://www.windowsembeddedeval.com/community/newsgroups
</Feedback>
 
same task with the framework. I often find that the trouble is in
determining the *best* one for a given situation.

Ah, so I'm not alone!! Thats a big, I hear ya, Tim. Thanks for the reply.
 
Back
Top