Format Function

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In VB6 you could use the format function to format strings using the @ and !
symbols. for example format("LEE", "!@@@@@@@@") would left align the string
"LEE" to the number of spaces allowed in the repeatings @'s. Has this
functionality disappeared in the format function for .NET, if so where has it
gone?
 
Lee said:
In VB6 you could use the format function to format strings using the @ and
!
symbols. for example format("LEE", "!@@@@@@@@") would left align the
string
"LEE" to the number of spaces allowed in the repeatings @'s. Has this
functionality disappeared in the format function for .NET, if so where has
it
gone?

You can use the String.Format function to get the same results.

Using {0,-100} or {0, 100} to left/right align.

Dim input As String = "Test"
Dim result As String

result = String.Format("{0,-10}", input)
' result now contains "Test "

result = String.Format("{0,10}", input)
' result now contains " Test"

HTH,
Mythran
 
Lee said:
I believe I found the answer to be LSET and RSET functions.

Thanks for your replies.

You should really check out the String.Format function :) It will do what
you want, and MORE! :)

Mythran
 
Back
Top