2

Is there a C# equivalent to the @ sign used in the VB6 format function?

VB6 (@ Character placeholder)
Display a character or a space. If the string has a character in the position where the @ appears in the format string, display it; otherwise, display a space in that position. Placeholders are filled from right to left unless there is an ! character in the format string.

Kirk Woll
  • 76,112
  • 22
  • 180
  • 195
DevSlick
  • 167
  • 11

1 Answers1

4

I guess you mean left-justify or right-justify using string.Format().

In c# it is:

string s = string.Format("{0,-10}", 42);
// s = "42        "

string s = string.Format("{0,10}", 42);
// s = "        42"
digEmAll
  • 56,430
  • 9
  • 115
  • 140